1
votes

I'm cycling though a bunch of PDFs, and merging them into a single PdfDocument. I load one PDF using XPdfForm.FromStream(stm), then add a new page using AddPage, and draw the XPdfForm to that page. This seems to be the typical way to do this.

Some of these incoming PDFs contain duplicate images. I'd like to eliminate these as they create a file much larger than required.

Given an input XPdfForm, and the desire to draw it onto a PdfPage using an XGraphics... how can I design code that would not add duplicate images, but instead refer to a reusable image?

1

1 Answers

0
votes

In an ideal world, PDFsharp would remove all duplicate objects (images, fonts) while saving.

It's on our wishlist. It seems there was already an implementation for this problem. http://forum.pdfsharp.net/viewtopic.php?f=4&t=648

I don't know why it was removed, but the old source is still available at SourceForge.