DLE rendering support enhancement: separation channels

DLE rendering support enhancement: separation channels

Datalogics has been bringing new engineers into working with DLE over the past several months, and we’re excited about enhancements that they have made to DLE in that time. One in particular is the ability to generate color separations as raster images for PDF pages. DLE has had the ability to generate PDF page separations as EPS files for some time. These changes enhance DLE to allow for rendering of PDF page separations to raster images. This allows saving these as any of the file formats that the Image object can be saved as (JPEG, PNG, TIFF) and for all other functionality of DLE Image objects.

Acquiring PDF page raster separations is easy and is demonstrated in the DrawSeparations samples for C# and Java included with DLE, but a couple extra steps over rendering a PDF page are required. To illustrate in Java:

1) Make the list of colorants to draw: this should include the process colors (Cyan, Magenta, Yellow and Black) as the first four list elements, followed by the names of separation (spot) color channels to draw. A shortcut is to get all colorants used on the page, and make separation color channels for each of these:

List<Ink> inks = pg.listInks();
List<SeparationColorSpace> colorants = new ArrayList<SeparationColorSpace>();

for (Ink ink : inks) {
  colorants.add(new SeparationColorSpace(pg, ink));
}

2) Set up the transform desired for the page and the other page drawing parameters. Here we transform the media box of the PDF page from PDF orientation to Java image orientation, and request that the image being drawn be placed on a white background (DO_LAZY_ERASE) and for annotations that have appearance streams to be drawn (USE_ANNOT_FACES):

 double width = pg.getMediaBox().getRight() - pg.getMediaBox().getLeft();
 double height = pg.getMediaBox().getTop() - pg.getMediaBox().getBottom();
 Matrix matrix = new Matrix().scale(1, -1).translate(0, -height);
 DrawParams params = new DrawParams();
 params.setMatrix(matrix);
 params.setDestRect(new Rect(0, 0, width, height));
 params.setFlags(EnumSet.of(DrawFlags.DO_LAZY_ERASE, DrawFlags.USE_ANNOT_FACES));

3) Executing the PDF page rendering can be done to a list of DLE Image objects, or to a list of Java BufferedImage objects; the list contains one image per channel in the order they were added to list of colors to draw:

 List<BufferedImage> separatedImages = pg.drawContents(params, colorants);

And that’s it! We hope you enjoy this new DLE feature.

2 thoughts on “DLE rendering support enhancement: separation channels

    1. One could render to the C, M, Y and K channels and see if the C, M and Y channels are all blank (0 – valued) as a check on whether a PDF page contains color. However, this is not foolproof – some calibrated RGB spaces, for example, render with some colorant in the C, M and Y channels . This is due to the nature of ICC color profile conversions.

      You may be better off going through the Element objects in the page and checking the colorspace of each element. This will tell you if an element is in a grayscale color space, or a different color space. However, if you want to determine if an Element in a non-gray colorspace only uses gray colorants (i.e. just the ‘K’ channel in CMYK, or only uses R=G=B colors in RGB) then you need to inspect the contents of the Element objects.

Leave a Reply

Your email address will not be published. Required fields are marked *