Compressing and optimizing PDF documents.

Q: I am looking for an API function to compress a PDF document.
Ideally, I'd like to be able to compress the document as I am creating
it rather than having to open an existing document for compression,
but either functionality would be fine.

I'm currently using PDFDoc.Save() with the
pdftron.SDF.SDFDoc.SaveOptions.e_linearized flag, but this is not
shrinking our file size.
A: PDFNet is by default compressing all PDF content during file
creation process (unless you explicitly tell it not to compress). Also
e_linearized flag does not affect compression (so the PDF will be
compressed even without e_linearized flag); linearization option is
used to generate a PDF that can be streamed for quick viewing over
slow communication channels (such as web viewing) and it does not
affect the file size.

Acrobat's 'Reduce File Size' option is actually downgrading the
quality of embedded images in order to reduce the file size. To
achieve similar effect using PDFNet simply embed lower resolution

You can also use PDFNet to implement functionality similar to
Acrobat's 'Reduce File Size'. In this case, you would open existing
PDF documents and walk through all images in the document replacing
them with low-resolution equivalents (e.g. using by sub-sampling image
data). At the same time you can also apply more efficient compression
schemes (such as JBIG2 and JPEG2000; PDFNet offers support for both).
If you are mainly dealing with text documents you may want to subset
or remove embedded fonts (see
For more optimization options and ideas you may want to search for
"PDF optimization" in the Knowledge Base. Please keeo in mind that
implementing some of the optimizations requires advanced knowledge of
PDF format.