ashish gupta

ashish gupta

  • NA
  • 94
  • 0

multiple pdf files in explorer

May 27 2008 7:40 AM

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.