DynaPDF Manual - Page 573
Previous Page 572 Index Next Page 574
Page 573 of 821
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()
The optional array ExcludeCS can be used to define an array of color space handles which should be
excluded from color conversion.
ExcludeCSCount can be set to a negative number to reverse the meaning. That means convert these
color spaces and ignore all others.
Color conversion rules
The function does never convert gray objects into a higher color space. Image data is left unchanged
if the image uses an indexed color space and if scaling is not required. Only the indexed color space
is converted in this case.
Interactive objects like annotations and form fields are not converted to the destination color space
unless these objects would be flattened beforehand. Annotations and form fields can be flattened
Objects that use overprinting can mostly not be converted to another color space without changing
the appearance of a page. To avoid issues with overprinted objects, the function can ignore such
objects, return with a fatal error, or convert them like any other object.
If overprinted objects should be excluded from color conversion, set the flag ofSkipOverprintedObj. If
the function should return with an error instead, set the flag ofFailOnOverprinting. If both flags are
absent then overprinted objects are converted to the specified color space.
Recommended compression filters
If PDF files are converterted to CMYK, e.g. for printing purposes, it is usually best to use loss-less
compression filters for all image types, e.g. JBIG2 for 1 bit images, and Flate for anything else. The
compression filters can be specified in the TOptimizeParams structure.
If no TOptimizeParams structure is provided, then images will be compressed with the same filter
that the original image used. The quality of JPEG and JPEG 2000 compressed images is taken from
the global property (see SetJPEGQuality()) in this case. Note that recompressing JPEG or JPEG 2000
images causes loss of quality.
Previous topic: Usage, Re-compressing 1 bit images with JBIG2, Text to outline conversion
Next topic: Special compression filter flags:, Image size check, Converting gray images to 1 bit (black & white), Image scaling, Spot color spaces