.net – Reduce filesize of pdf

filesizenetpdf

I have a pdf that is around 4MB in size. When I open it in Adobe Acrobat (version 8) and go to File -> Save as the resulting pdf is only 137KB.

This pdf is 67 pages big, each page looking very similar to the other, with only some numbers changed: same background, same fonts, almost same text, …
It has been created using Cete DynamicPDF Merger from individual pdf files.

What I think could be a possible cause are the fonts: when I check file->properties and look at the Fonts tab I see that the same font has been included multiple times in it. The new pdf that Acrobat saves only has that font once.

Is there a tool (preferably a .NET library) that would allow me to compress pdf's files like that one similar like Acrobat does?

Best Answer

You may try with iTextSharp. I've been using it for a long time and I'm satisfied with the resulting PDF size:

Document.Compress = true;
var reader = new PdfReader("input.pdf");
using (var output = File.OpenWrite("output.pdf"))
{
    new PdfStamper(reader, output).Close();
}