Save() creates corrupt PDF (.NET 2.0)

Just downloaded and installed. Running on local machine (localhost), running your Hello World example:

Export.CreatePDF(int.Parse(RentalPropertyId), Response);
PDFDocument pdfDoc = new PDFDocument();
IPDFFont pdfFont = pdfDoc.Fonts.Add(FontBaseFamily.TimesRoman);
IPDFPage firstPage = pdfDoc.Pages[0];
firstPage.Graphics.DrawText(0, 0, "Hello World!", pdfFont);
pdfDoc.Save("Sample.pdf", Response, HttpReadType.Save);

The file is corrupt. Adobe Reader v7.0 reports:
"The file is damaged and cannot be repaired."

Please advise. Thank you.

Sample70.zip

7 Replies

AD Administrator Syncfusion Team October 3, 2006 06:10 AM UTC

Nevermind. I figured it out. If you have @Page Trace="true" then you get all the tracing output tacked onto the pdf which renders it useless. Even explicitly clearing the Response before calling Save() and calling Response.End() after the save won''t fix. It appears ASP.NET tacks on the tracing output even after Response.End() is called.

Sean


RB Rudy Bruning February 27, 2007 04:22 PM UTC

I have the same problem.. what did you do to correct this?

Thnx,

Rudy

>Nevermind. I figured it out. If you have @Page Trace="true" then you get all the tracing output tacked onto the pdf which renders it useless. Even explicitly clearing the Response before calling Save() and calling Response.End() after the save won't fix. It appears ASP.NET tacks on the tracing output even after Response.End() is called.

Sean


AD Administrator Syncfusion Team February 27, 2007 04:26 PM UTC

I use this save :
Stream pdfData = new MemoryStream();
pdfDoc.Save(pdfData);

>I have the same problem.. what did you do to correct this?

Thnx,

Rudy

>Nevermind. I figured it out. If you have @Page Trace="true" then you get all the tracing output tacked onto the pdf which renders it useless. Even explicitly clearing the Response before calling Save() and calling Response.End() after the save won't fix. It appears ASP.NET tacks on the tracing output even after Response.End() is called.

Sean


KG Kathy Gray June 15, 2007 07:03 PM UTC

How do you open it then in the browser?

>I use this save :
Stream pdfData = new MemoryStream();
pdfDoc.Save(pdfData);

>I have the same problem.. what did you do to correct this?

Thnx,

Rudy

>Nevermind. I figured it out. If you have @Page Trace="true" then you get all the tracing output tacked onto the pdf which renders it useless. Even explicitly clearing the Response before calling Save() and calling Response.End() after the save won't fix. It appears ASP.NET tacks on the tracing output even after Response.End() is called.

Sean


MW Melba Winshia Syncfusion Team June 18, 2007 12:31 PM UTC

Hi Kathy,

Could you please let us know if you are also facing the error "The file is damaged and cannot be repaired" while running our Hello World example? This would help us to analyze this issue further.

Thanks,
Melba


KG Kathy Gray June 18, 2007 04:55 PM UTC

I'm glad you asked, because the issue I was having was not on my computer, but on our server. When I tried the hello world sample on the server, I was able to see what the problem was. Apparently, when I save the document, it requires the Syncfusion.Compression.Base.dll. It's odd, since I don't have to reference that dll in my project.

So, anyone else who may be having this problem, try adding Syncfusion.Compression.Base.dll to your bin folder.

-Kathy

>Hi Kathy,

Could you please let us know if you are also facing the error "The file is damaged and cannot be repaired" while running our Hello World example? This would help us to analyze this issue further.

Thanks,
Melba


MW Melba Winshia Syncfusion Team June 19, 2007 04:19 AM UTC

Hi Kathy,

Glad to hear that issue is resolved by adding Syncfusion.Compression.Base.dll.

Note:
-----

You need to include the following assemblies during deployment

Syncfusion.Compression.Base.dll
Syncfusion.core.dll
Syncfusion.Shared.Base.dll
Syncfusion.DLS.Base.dll
Syncfusion.pdf.base.dll

Kindly let me know if you have any other questions.

Thanks,
Melba

Loader.
Up arrow icon