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.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.

Share this post with your friends

Get instant access to the latest PDF news, tips and tricks!

Do you want monthly updates on the latest document technology trends?

By submitting the form, you agree to receive marketing emails from Datalogics. You may unsubscribe at any time. 

Like what you're reading?

Get Datalogics blogs sent right to your inbox!

By submitting the form, you agree to receive marketing emails from Datalogics. You may unsubscribe at any time.