The ColorConvertDocument sample program demonstrates working with color conversion in PDF documents. The color conversion process allows you to apply a different color profile to an object in a PDF document, and thus effectively change the colors found in that object. This process applies a set of colors to an image or other object within a PDF and embeds that information in the document, so that the right set of colors will be rendered when the PDF document is sent to a printer or to another output device. Note that the color profile is not embedded by default; rather, the default is not to embed the color profile. The user must set the option to embed to True.
The Java interface offers color conversion for PDF element and page objects, to match the color conversion offered in the core Adobe PDF Library API PDDocColorConvertPageEx. This program and the related APIs can convert any object within a PDF document, including images, text, and line art.
The program creates a list of color conversion steps to apply to a PDF document, comparing every object in the document against selection criteria. If it finds a match, it will apply the appropriate color profile. Any object in the PDF can be a candidate for color conversion, and any kind of color space may be used.
The Java interface offers three APIs:
|Page||ColorConvertPages||Color converts the objects on an individual page that match the pattern set by the user with the ColorConvActions class|
|Document||ColorConvertContent||Color converts the content of all of the pages in a PDF document that matches the pattern set by the user with the ColorConvActions class|
|Elements||ColorConvert||Color converts only a specific element on a PDF page such as a container an image a form or a group|
To learn more, see our descriptions other Java sample programs that also work with color spaces.