File saved with iText7 not displaying correctly in nuance pdf professional 5

134 Views Asked by At

Edit to add PDF link

I have an outlook add in which edits a PDF attached to an email using iText 7.

The code (c#) appears to function correctly and when opening the PDF in Acrobat or Kofax power PDF, the formatting is correct. When the same PDF is opened in Nuance PDF professional 5, only the text entered into the form fields remain visible. If the same PDF is opened in acrobat or Kofax, and a copy saved of the same file, it then opens correctly in Nuance.

I have tried flattening the pdf which results in no visible text in Nuance (essentially a blank PDF). I also identified that the issue only occurs for PDFs which have had a written signature added to them from an iPad.

Finally, I have noticed that file saved through iText is 50-100 kb smaller than the same pdf saved through Acrobat. I set compression to no_compression but this did not impact the results.

Any help would be greatly appreciated.

1

There are 1 best solutions below

3
On

In comments the OP provided both the state of the file their code handled which Nuance PDF Professional displays incorrectly - "Electronic Daily Timesheet Template V2.24.pdf" - and the state of that file saved as by Adobe Acrobat which Nuance PDF Professional displays correctly - "Electronic Daily Timesheet Template V2.24 (Same file once saved from Adobe Acrobat reader).pdf" . The main differences are as follows.

  • The objects of "Electronic Daily Timesheet Template V2.24.pdf" and "Electronic Daily Timesheet Template V2.24 (Same file once saved from Adobe Acrobat reader).pdf" differ hardly at all, essentially only the page content has been split up into a larger number of partial streams.

    I doubt Nuance PDF Professional has issues handling the larger partial content streams of the former document, this would much more often cause issues. Nonetheless it cannot be completely ruled out as the cause of the issue.

  • Looking into the way the objects are stored in the file, though, there is a very relevant difference: The former file is stored as sequence of revisions while the latter has been flattened into a single revision. And this is relevant because there are structural errors in the first revision of the former document (without fill-ins or signature scribbles), the cross reference table is invalidly built. Adobe Acrobat, when flattening those revisions into a single one, has created the latter file with a valid cross reference table.

    This error in the former file is also known to cause issues in Adobe Acrobat in work flows with multiple digital signatures. It might also cause arbitrary issues in other PDF processing software like Nuance PDF Professional.

    (The exact error in the cross reference table is a segmentation which is forbidden in the first revision in a PDF, compare this, this, and numerous similar stackoverflow answers.)