In version v2105R1, a new feature was added to our PDF to Image Conversion Library, jPDFImages,  that allows rendering a page in a PDF document to CMYK color space or to any custom color space. Previous versions of the library would only render to the RGB color space which is typical when rendering to a computer screen.

Here is a sample code showing how to retrieve a page as an image rendered to the gray color space shipped with Java. Typically, customers would want to use their own printer color space.

PDFImages pdfDoc = new PDFImages ("C:\\input.pdf", null);
// Get an image of the page in the expected resolution and color space
BufferedImage pageImage = pdfDoc.getPageImageCS(0, 150, ColorSpace.getInstance(ColorSpace.CS_GRAY));

Download Java sample below.

jPDFImage Export PDF to Color Space Image Java Source Code Sample
1.4 KiB