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

Saving PdfDocument several times
https://forum.pdfsharp.net/viewtopic.php?f=3&t=1044
Page 1 of 1

Author:  baSSiLL [ Wed Feb 03, 2010 2:02 pm ]
Post subject:  Saving PdfDocument several times

PdfSharp 1.31

When invoking PdfDocument.Save second (and next) time on the same instance there may be errors.
1) If there are embedded Unicode fonts in the document then an InvalidOperationException raises from the PdfToUnicodeMap.PrepareForSave method.
2) If the PdfDocument.Options.CompressContentStreams is set to true then corrupted PDF is generated.

I've attached a patch for both situations. Note that line numbers may slightly differ.

Is multiple times saving of a document is supported by design? The case is generation of huge report in interactive application. The contents of report is got from server in parts. When the next part is received and rendered to PdfDocument I want to present the current contents of the document to the user. For some reasons I cannot use rendering to GDI+ Graphics offered by PdfSharp and use Acrobat ActiveX for presenting PDF files. That's why I need to save the document before it is complete.

Attachments:
File comment: A combined patch for PdfToUnicode.cs and PdfContent.cs.
patch.zip [564 Bytes]
Downloaded 751 times

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