Automatic optimization of PDFs
PDF files processed by pdfToolbox are automatically optimized when changes have been applied (e.g. via a Fixup or an Action) and file is saved. These optimizations are only applied when the PDF is saved - so this is not the case when an analysis-only processing is performed.
Even a normal re-save of a PDF will trigger the optimization.
All variants (Standalone, Server/CLI and SDK) of pdfToolbox 12 are doing the following optimizations by default:
- Remove unreferenced objects
- Optimize content stream (generating substreams that can be shared)
- Merge identical forms and images (determined by an MD5 hash of their contents)
It is also possible to:
- Also merge identical font descriptors and encodings
- Disable the optimization completely
Adjust optimization in pdfToolbox Desktop
The way a PDF is going to be optimized in Standalone can be adjusted in the preferences:
Adjust optimization in pdfToolbox Server/CLI
- The additional merge of identical font descriptors and encodings can be requested by the additional option
--optimizepdfwithin a CLI command (as long as this command creates an output PDF).
- Disable the optimization completely can be requested by the additional option
--nooptimizationwithin a CLI command (as long as this command creates an output PDF).
When using the hotfolder processing in Server, these options have to be set a an additional CLI parameters within each job.
For obvious reasons, the 2 options can not be combined.
The previously available action
--optimizepdf has been deprecated, but can easily be substituted by:
as --optimizepdf has become a general file processing option on CLI.
Optimization in pdfToolbox 11 and older versions
In pdfToolbox 11 and previous versions, the automatic optimization also optimized the font structure by default.