Hi guys,
I'm using PDFSharp (in a C# .NET4.8 program) to merge several invoice PDFs into one, however the merged file size is largely proportional to the number of PDFs.
The reason is because each page on a PDF has the same company logo (JPEG), which is referenced for each PDF being merged in.
e.g. if image is 60KB, then merging: 2 PDFs will be around 125KB (2x 60KB company logos + 5KB other data) 3 PDFs will be around 190KB (3x 60KB company logos + 10KB other data) ..etc.
My question is how would I go about reusing one of the referenced company logos (e.g. within first PDF), and then removing/replacing the referenced image in subsequent PDFs being merged in?
I've played around with creating a 'shared resource' dictionary; Looping through pdf->pages->"/Resources"->"/XObject", and then trying to use .SetReference on the DictionaryElements, but is not working as expected.
Looking forward to hearing back.
Regards
Attachments: |
File comment: PDF structure. One /XObject image per page.
Screenshot 2023-05-29 170530.png [ 112.91 KiB | Viewed 49044 times ]
|
|