Click here to Skip to main content
13,143,637 members (30,194 online)
Rate this:
Please Sign up or sign in to vote.

I am using iTextSharp for creating PDF for reports in ASP.Net (c#).
Pdf is created successfully & can be opened when running the Application, but when iam hosted in IIS it cannot open in PDF and gives error :

"adobe reader could not open pdf because it is either not a supported file type or because the file has been damaged "

My code like:

            Document pdfDoc = new Document();
            string filepath = "Demo" + ".pdf";
            string attachment = "attachment; filename=" + filepath;
            Response.Charset = String.Empty;
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/PDF";
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            //Adding some paragraph in to the pdfdoc.            

Please help me!!

I am waiting for your greatfull ideas !
Posted 5-Nov-12 21:23pm
ryanb31 8-Nov-12 15:24pm
I would make sure the path is accurate.
Adersh Ram 9-Nov-12 3:57am
Hi Ryan,
I resolved the issue.
Problem is loading an image logo to pdf page, so i just take image from a memmory stream.

Thanks for your reply.
Julius Depulla 23-Jan-13 1:33am
Hi, I have the same problem, how do I take a image from the memory stream

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100