Dear all,

I need to extract, for each color separation, the rasterized image that
represents it. I need to preview each color of the PDF. This is the code I
came up with, do you know how can I get a BufferedImage?

Or a better way to approach the problem would be really helpful!

Groovy (but you can suggest with Java, no problem with that)

for (page in input.pages) {
    for (name in page.resources.colorSpaceNames) {
        PDColor color = page.resources.getColorSpace(name).initialColor
        PDColorSpace cs = color.getColorSpace()

        if (cs in PDSeparation) {
            WritableRaster raster = ???
            BufferedImage img = cs.toRGBImage(raster)
            results.add(cs.colorantName)
        }
    }
}


Gianluca Sartori
--
Cell. +39 388 1026822

Reply via email to