DynaPDF Manual - Page 588
Previous Page 587 Index Next Page 589
Function Reference
Page 588 of 839
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.
Color conversion
The function converts images, text, and vector graphics to a device color space if one of the flags
ofConvertToGray, ofConvertToRGB, or ofConvertToCMYK is set.
If color management is enabled (see InitColorManagement() for further information), make sure that
the destination color space is set to the same output color space as specified in the Optimize()
function call.
Previous topic: Usage
Next topic: Color conversion rules, Overprinting, Recommended compression filters