I am using the following code to print a PDF document, in my print button I'm using this code:
Panel1.Controls.Add(new LiteralControl(" <object id = 'Object1' name='Pdf2' type='application/pdf' width='1' height='1' ><param name='SRC' value='PrintPDFFile.aspx' /></object> "));
ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language=JavaScript>document.Pdf2.printWithDialog();</script>");
and in the 'PrintPDFFile.aspx' page , I am creating the PDF
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
pdfDoc.Add(new Paragraph("TEST"));
pdfDoc.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline;" + "filename=sample.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
Response.End();
This code works fine with IE browser but doesn't work with other browsers such as FF, how it can be modified to work fine with other browsers?