PDF Processing alters PDF contents when importing

1 Answer 51 Views
PDFViewer
Travis
Top achievements
Rank 1
Iron
Travis asked on 03 Jan 2023, 03:42 PM
I have found what I believe is a bug in the PDF Processing library in which the resulting PDF does not "match" the contents of the PDFs imported into it. I have created a very simple example in which I attempt to import a single PDF document into another PDF using the PdfStreamWriter class and associated classes. I also tried using the PdfFormatProvider and receive the same results.

A few things to note regarding the original PDF being used: it was generated from a Telerik Report using the ReportProcessor's RenderReport method. So, this PDF was created entirely through Telerik libraries and I would expect that it should be able to be imported into another PDF document unaltered using the Telerik PDF Processing library.

But, in the example provided, if you click the First button, the application will open the PDF being used so you can see what it should look like. Notice the table on the first page is completely filled in. Clicking the second button attempts to import the original source PDF into a temporary file and displays that result: notice in this case, the table on the first page is missing some of the data that appears in the original.

As I have tried both the PdfStreamWriter and PdfFormatProvider classes with the exact same results, I am at a loss as to what is wrong. I would expect that the results should be the exact same since everything was created using Telerik libraries...

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 06 Jan 2023, 07:24 AM

Hi Travis,

Thank you for the feedback and for the sample project and document you shared with us.

This helped me to successfully reproduce the described behavior.

It seems there is an issue with the provided document and I contacted the Telerik Reporting team to investigate the issue. It seems that the produced document has invalid offsets cross-reference table offsets and invalid offsets of the objects inside the cross-reference table. This makes it invalid but it is handled by most of the PDF viewers partially including the PdfProcessing library.

I mean partially because these are two different issues:

  1. Handle import of documents with invalid cross-reference table offsets.
  2. Handle import of documents with invalid offsets of the objects inside the cross-reference table.

The first one is with status Completed but it seems there is a problem in the handling logic with this specific document and I logged it in order to fix it: 

Please subscribe to all still not completed items in order to keep you informed about their progress.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PDFViewer
Asked by
Travis
Top achievements
Rank 1
Iron
Answers by
Martin
Telerik team
Share this question
or