public class RGBtoCMYKColorMapper extends PdfBoxGraphics2DColorMapper
PdfBoxGraphics2D pdfBoxGraphics2D = new PdfBoxGraphics2D(this.doc, (int) (width), (int) (height)); PdfBoxGraphics2DColorMapper colorMapper = new RGBtoCMYKColorMapper(icc_profile); pdfBoxGraphics2D.setColorMapper(colorMapper);
Where ICC_Profile is an instance of java.awt.color.ICC_Profile that supports a CMYK colorspace. For testing purposes, we're using ISOcoated_v2_300_bas.icc which ships with PDFBox.
IPdfBoxGraphics2DColorMapper.IColorMapperEnv| Constructor and Description |
|---|
RGBtoCMYKColorMapper(ICC_Profile icc_profile,
org.apache.pdfbox.pdmodel.PDDocument document) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.pdfbox.pdmodel.graphics.color.PDColor |
mapColor(Color rgbColor,
IPdfBoxGraphics2DColorMapper.IColorMapperEnv env)
Map the given Color to a PDColor
|
public RGBtoCMYKColorMapper(ICC_Profile icc_profile, org.apache.pdfbox.pdmodel.PDDocument document) throws IOException
IOExceptionpublic org.apache.pdfbox.pdmodel.graphics.color.PDColor mapColor(Color rgbColor, IPdfBoxGraphics2DColorMapper.IColorMapperEnv env)
IPdfBoxGraphics2DColorMappermapColor in interface IPdfBoxGraphics2DColorMappermapColor in class PdfBoxGraphics2DColorMapperrgbColor - the color to mapenv - the environment which allow getting the content stream, resources
etc.Copyright © 2022. All rights reserved.