Can I retain Bookmarks/Acroforms with PDFStreamWriter?

1 Answer 138 Views
PdfProcessing
Aidan
Top achievements
Rank 1
Aidan asked on 07 Dec 2022, 10:40 PM
Hello,

I have two, semi-related questions.

Question 1: Is it possible append pages using PDFStreamWriter to an existing document without fully overwriting it and wiping out the Document level properties?

I need to create a PDF report that is a combination of code generated pages and an appendix of externally sourced PDFs (cut sheets, specification documents, etc.). Since I don't need to modify the appendix PDFs, I'd like to create the code portion using the RadFixedDocument and then attach the appendix PDFs using the more memory efficient PDFStreamWriter. Unfortunately, I need to retain bookmarks, interactive form fields and other document level data from the code generated portion, so I can't use the Page-by-Page Stream merge shown in your examples.

I would much prefer to use the PDFStreamWriter merge method since, again, I do not modify the appendix PDFs and, since the PDFs can be quite large, the memory footprint with RadFixedDocument is very high.

Question 2: Is there a way to direct which font is used for unrecognized Font types during import? Alternatively, is there a setting I can apply so Merged/Imported PDF content will not be modified?

Assuming I need to use RadFixedDocument to maintain the bookmarks, when I import some appendix PDFs any non-embedded fonts that aren't recognized are defaulted to Helvetica. This results in a bad presentation of the final merged export. This occurs even when I manually register the font in the FontsRepository before importing.

Attached are example images and a Zip containing the PDF and Font ttf.

I am using the Telerik.Windows.Documents.Fixed API for .NET Framework.

Thank you,
Aidan D.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 09 Dec 2022, 11:20 AM

Hello Aidan,

Directly to your questions: 

1. This is not supported with the PdfStreamWriter. We have a feature request for it on our feedback portal. You can track its progress, subscribe to status changes, and add your comment to it here: Implement API for stream writing whole PDF documents and their properties

The above link contains a workaround as well.

2. I was able to reproduce this. It is caused by an issue in our implementation. I have logged it on your behalf. You can track its progress, subscribe to status changes, and add your comment to it here: Pdfprocessing: The Helvetica-UltraCompressed font is not parsed correctly and is changed to Helvetica. I have updated your Telerik points for this report. 

I am afraid I cannot suggest a workaround for this.

I want to apologize for the inconvenience this missing functionality is causing you.

Regards,
Dimitar
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.

Aidan
Top achievements
Rank 1
commented on 09 Dec 2022, 05:16 PM

Thank you for your response and the links. 

Thankfully, the issue with the Helvetica-UltraCompressed does not occur in any of the other PDFs I've tried importing.  Not surprising given the issue is with the font itself. 

My workaround in the past for these kinds of errors is to run the PDF through a Print-to-PDF process via a separate viewer to "flatten" everything before importing.  It works, but only if the error is noticed.  Not an ideal solution with potentially hundreds of pages to check.

Regards,

Aidan D.

Dimitar
Telerik team
commented on 12 Dec 2022, 09:38 AM

Hi Adrian,

Indeed there is no good way to catch such issues. I am afraid I cannot think of a way to handle this that does not include manually checking the document. 

Let me know if I can assist you further.

Tags
PdfProcessing
Asked by
Aidan
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or