DynaPDF Manual - Page 572
Previous Page 571 Index Next Page 573

Function Reference
Page 572 of 821
Optimize() does not rebuild font subsets like CheckConformance(). The function is part of DynaPDF
Professional.
Usage
It is assumed that this function is called right before closing the PDF file. It is not allowed to call the
function twice for the same PDF file in memory.
After Optimize() was executed, close the file with CloseFile(), CloseFileEx(), or CloseAndSignFile()
for example.
If the flag ofInMemory is absent, then pages are directly written to the output file after optimization
to reduce the memory usage. If the PDF file was created in memory (this is the case if no ouput file
name was passed to CreateNewPDF()) then the output file must be opened with OpenOutputFile()
or OpenOutputFileEncrypted() beforehand. Note that it is not possible to sign the PDF file if the flag
ofInMemory is absent.
If the file should be signed too, then import the resulting PDF file again and sign it with
CloseAndSignFile() or CloseAndSignFileEx() for example.
Re-compressing 1 bit images with JBIG2
If the flag ofCompressWithJBIG2 is set, 1 bit images will be re-compressed with JBIG2 (if the image
was not already compressed with this filter). This can drastically reduce the file size since JBIG2
compression achieves much higher compression rates than any other 1 bit image filter that PDF
supports. The JBIG2 compression filter in DynaPDF is lossless, that means the original image quality
will be preserved.
Text to outline conversion
The function converts text to outlines if the flag ofConvTextToOutlines is set. The flattening algorithm
loads exactly the same fonts as the rendering engine would load and it scales fonts in the very same
way. What you see is what you get.
Outlines are scaled to a master size of 1000 units to achieve high quality output. It stores hinted
outlines with preserved curves. The resulting PDF files are much smaller in comparison to fully
flattened outlines and offer higher quality since curves stay smooth regardless of the zoom factor.
It is also possible to restrict the conversion to non-embedded fonts with the flag
ofConvNonEmbFontsOnly since these fonts are usually the problematic ones when printing on
Postscript devices.
Annotations and form fields are not affected by the conversion. In order to consider these objects too
it is possible to flatten all annotations and form fields before calling Optimize(). See FlattenAnnots()
for further information.
Previous topic: Optimize
Next topic: Color conversion, Color conversion rules, Overprinting, Recommended compression filters