PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Nov 02, 2024 12:08 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon May 29, 2023 4:41 am 
Offline

Joined: Mon May 29, 2023 4:29 am
Posts: 1
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
Screenshot 2023-05-29 170530.png [ 112.91 KiB | Viewed 49044 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group