PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Corrupt PDF after Merge
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2317
Page 1 of 1

Author:  Pascal Ziener [ Mon Jan 28, 2013 8:51 am ]
Post subject:  Corrupt PDF after Merge

Hello,

we use pdfsharp to create pdf documents. Up to that point everything is okay. In a second step we merge these documents to multiple bigger pdfs. We do it as descriped at http://www.pdfsharp.net/wiki/CombineDocuments-sample.ashx. But sometimes in one file a few pages (1-3) get corrupted and we can't print that pdf file with Acrobat Reader. With the Foxit Reader we can open and print that pdf.

I want to ask if thats a known problem and/or somebody knows a workaround?

Before somebody asks, i can't submit the faulty pdf because it's full of personal data. :cry:

Cheers,
Pascal

Author:  Thomas Hoevel [ Mon Jan 28, 2013 9:41 am ]
Post subject:  Re: Corrupt PDF after Merge

Hi!
Pascal Ziener wrote:
Before somebody asks, i can't submit the faulty pdf because it's full of personal data. :cry:
Any chance to replicate the problem with anonymized or synthetized data?

Author:  timho [ Tue May 14, 2013 11:01 pm ]
Post subject:  Re: Corrupt PDF after Merge

We have the same problem with several difference cases. One of the case is that we combine 143 pdf files and we got 1 corrupted page. Then we look into that individual pdf and that is fine, no corrupted page. When we import that pdf only, the combined pdf (1 pdf) works fine. When we combine 3 pdfs, it works too.

Having said that, I notice that there is a message displayed in the visual studio output

"PrepareForSave: Number of deleted unreachable objects: 3"

After I commented out the following code in PdfDocument.cs, no corrupted page in the combined pdf.

//int removed = this.irefTable.Compact();
//if (removed != 0)
//Debug.WriteLine("PrepareForSave: Number of deleted unreachable objects: " + removed);

I don't know whether this is the right thing to do, that is why I need your help.

Author:  Stefan Lange [ Thu May 16, 2013 1:16 pm ]
Post subject:  Re: Corrupt PDF after Merge

I found this bug very recently. Remove the following superfluous lines in function TransitiveClosureImplementation in class PdfReferenceTable (file PdfReferenceTable.cs)

//if (depth-- == 0)
// return;

Very stupid bug – sorry for that.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/