I faced the following issue while generating pdf files on mobile browser.The file either got corrupted on some mobile browsers while in some the file got downloaded but didn't display the text,it displayed only images in the file.Meanwhile the file got generated perfectly when working on desktop browsers and the file content were displayed perfectly when downloaded. I don't know actual reason behind it as I am totally new in developing web applications.
The code I used is given below:
Document pdfDoc = new Document(PageSize.A4, 10, 10, 10, 10);
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
string imageUrl = Server.MapPath("~/logo//bcetlogo.jpg");
iTextSharp.text.Image ImageLogo = iTextSharp.text.Image.GetInstance(imageUrl);
ImageLogo.ScaleToFit(80f, 80f);
pdfDoc.Add(ImageLogo);
Font f = FontFactory.GetFont("Arial", 15);
string title = "HelloWorld";
Paragraph text1 = new Paragraph(title, f);
pdfDoc.Add(text1);
pdfWriter.CloseStream = false;
pdfWriter.Close();
Response.Buffer = true;
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=Example.PDF");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
Response.End();