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

Merging PDFs and file size
https://forum.pdfsharp.net/viewtopic.php?f=2&t=584
Page 1 of 1

Author:  mikebruner [ Thu Dec 18, 2008 7:58 pm ]
Post subject:  Merging PDFs and file size

I am using PDFSharp to merge multiple PDF files into one PDF. I'm following the ConcatenateDocuments example.

The PDFs I am combining are all very similar -- they are almost entirely text and use the same fonts.

When I concatenate many files together the file size is very large and I don't quite understand why. If I combine 10 similarly-sized 1MB files together the resulting file size is about 10MB. However if I try another tool such as ABCpdf the resulting file size is much smaller, around 2MB or a little less.

Is there some sort of setting I am missing here? Any tips on how to get the file size down?

Author:  Thomas Hoevel [ Thu Jan 08, 2009 9:52 am ]
Post subject: 

Are you using a Release build? The Debug build creates larger, formatted PDF files for debugging.

Look at the font list of the resulting document. AFAIK the current implementation of PDFsharp doesn't merge the fonts of the source documents (but this is on the To Do list).
With PDFsharp it's more efficient to have a 100 page resource file than 100 single page source files: if you copy 10 pages from a huge 100 page file, fonts will be included only once (I dunno if that helps with your application).

Author:  mikebruner [ Thu Jan 08, 2009 2:23 pm ]
Post subject: 

I verified I am using a release build, that doesn't seem to be the issue.

I am not sure how I can tell if PDFSharp is repeatedly including font information for each appended document. When you say to look at the font list of the resulting document, what am I looking for?

Author:  Thomas Hoevel [ Thu Jan 08, 2009 3:06 pm ]
Post subject: 

Open the PDF in Adobe Reader and press Ctrl+D, then go to the Fonts tab.

Names like "Arial", "Arial,bold", "Arial,italic", "Arial,bolditalic" are no duplicates, but different glyphs of the font Arial.

But if you see identical glyph names more than once then these are likely duplicated fonts (normally these are font subsets so you can't tell for sure if they are identical subsets).

PDFsharp was developed to create new PDF files. It's not yet optimized for merging files.

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