0
Answer

multiple pdf files in explorer

ashish gupta

ashish gupta

16y
1.4k
1

I want to display multiple pdf files in internet explorer actually i'm using this code to display

pdf files

MemoryStream ms = new MemoryStream();

PdfWriter writer = PdfWriter.GetInstance(document,ms);

document.Open();

document.Add(p2);

document.Add(p3);

document.Add(p1);

document.Close();

byte[] byteArray = ms.ToArray();

Response.Clear();

Response.ClearHeaders();

Response.ClearContent();

Response.ContentType = "application/pdf";

Response.AppendHeader("Content-Length", byteArray.Length.ToString());

Response.AddHeader("Content-Disposition", "inline;filename=test.pdf");

Response.BinaryWrite(byteArray);

above code is in loop it executes one time bt at second time it display error that 'Cannot access a closed Stream.'

when i write document.close()  after loop then it displays error  so plz help me.