Optimizing PDFs

I’m building a tool that rasterizes PDFs (amongst other things), but also tries to optimize them first so that conversion goes smoother.

I’ve got a pretty good idea of what each of the members of TRN_optimizerimagesettings mean, but there’s a couple that elude me:

  • m_max_pixels
  • m_max_dpi
  • m_resample_dpi

Does anyone know exactly how these affect optimization and how / when they’re used or triggered?

Thanks in advance.

It looks like you are using low-level C interface.

For documentation please take a look at higher level C++/Java/.Net interfaces (http://www.pdftron.com/pdfnet/documentation.html).

For example:

pdftron::PDF::Optiomizer::ImageSettings
pdftron::PDF::Optimizer::MonoImageSettings
pdftron::PDF::Optimizer::TextSettings

You can see exactly how these high-level interfaces relate to C API by looking at ‘Headers/Impl’.

Btw. based on your description it looks like pdftron.PDF.Flattener may be a better match with your app. From: http://www.pdftron.com/pdfnet/addons.html#Flattener :

"PDF Flattener ( pdftron.PDF.Flattener) can be used to speed-up PDF rendering on mobile devices and on the Web.

PDF documents can frequently contain very complex page description (e.g. thousands of paths, different shadings, color spaces, blend modes, large images etc.) that may not be suitable for interactive viewing on mobile devices.

Flattener can be used to speed-up PDF rendering on mobile devices and on the Web by simplifying page content (e.g. flattening complex graphics into images) while maintaining vector text whenever possible.

A quick way to try Flattener is by using DocPub CLI (e.g. docpub -f pdf my.pdf). If you prefer working with code, please take a look at the last code snippet in the Optimizer sample (which is included part of PDFNet SDK)."