Adobe® PDF Library

Manipulating Graphics and Separating Colors for Images


View Sample Code

This program shows how to work with clipping paths within a PDF file to create a graphics object.

When you run the program it creates the image and saves it to a file called clip_out.PDF.

Use a clipping path to edit a graphic design by removing part of the art, so that only the shapes that you want appear.  You could use a clipping path to remove a background in a photo, for example, so that a person or object is highlighted and the background is white. Or you could super-impose text over an image.  With a clipping path, only part of an image appears through a shape or shape that you create.


View Sample Code

The DrawSeparations sample program draws a list of grayscale separations from a PDF file, one for each of the Cyan, Magenta, Yellow and Black (CYMK) channels.

The program provides a default PDF input file name. You can enter your own input file name in the program code, or add it as a command line parameter.

The program will generate four separate PNG files, one each for Cyan, Magenta, Yellow, and Black, and in each one showing the color presented as a grayscale, like this:
Rendering color images in greyscale is a useful way to retain the precision of an image when printing or displaying it in black and white.


View Sample Code

This program will open two sample PDF files called SpotColors.PDF and SpotColors1.PDF and separate the individual colors shown into a series of Encapsulated PostScript (EPS) graphics files.

SpotColors1.PDF looks like this:


From this the program generates a series of 30 color-separated EPS files.  Besides the standard CYMK colors mentioned, some of the EPS files define colors by the PANTONE color system, such as PANTONE 1797C or PANTONE 554 CVC.  Each EPS file represents a single color plate.  The Complex EPS files are drawn from SpotColors.PDF, and the Simple EPS files correspond to SpotColors1.PDF.

Color separation is part of high volume offset printing processing.  The original digital content is color separated to create a set of plates for printing, generally one plate per page for each of the primary colors, cyan, magenta, yellow, and black. During printing each color layer is printed separately, one on top of the other, blended together to create the depth and variety of color in the final images.

To create the color-separated plates as a part of the pre-press process, usually the original digital file to be printed is separated into a series of Encapsulated Post Script (EPS) files.  EPS is a standard graphics file format for working with text, images, drawings, and layouts that can be dismantled into their component parts and then be combined into a final completed document.  EPS files can present both bitmap and vector data, and they can be scaled up or down without distortion. An EPS file is really part of a collection of several image files; hence the name “encapsulated.”

When you run EPSSeparations the program will open the sample PDF file, identify each color on each page, and make the color separations to produce the set of EPS files.  You don’t need to enter any values on the command line.  You can use this code as a model for building your own color separation process to generate pre-press EPS files from an original PDF file.


View Sample Code

This sample program shows how to use an API to draw a list of grayscale separations from a PDF file to a TIFF file with multiple pages.

The program provides a default PDF input file name. You can enter your own input file name in the program code, or add it as a command line parameter.

This program is similar to DrawSeparations, except that it generates only one file, a TIF image.  And this TIF file has one page for each page in the PDF file.  Note that the program is written to only select graphics found on the first page of the PDF file that you enter.


View Sample Code

To run this program, enter the name of the PDF file after you enter the program name.  Enter the path name too, if the PDF file is in a different directory:

Writenchanneltiff test.PDF


Writechanneltiff Z:\colormanager\resources\samples\test.PDF

The program generates a multi-page TIF file.  Note that it will only select graphics from the first page of the PDF file that you enter.

Channel colors are used for printing specialized graphics that require a precise, pre-defined color.  For example, many corporate logos use a specific color that must appear every time the logo appears in print or on a screen, as with IBM Blue.  In a case like this the color will often be defined with a specific Pantone color number.  When the logo appears anywhere, the color may not be substituted with the closest possible blended or approximate color.  TIF and PDF files support using channels to define specific colors.  Within a PDF file you can, at the level of a specific pixel location, describe exactly the right color to use.  This program describes how to work with these color settings in a PDF file.