Top Description Fields Constructors Methods
de.rototor.pdfbox.graphics2d

public Class RGBtoCMYKColorMapper

extends PdfBoxGraphics2DColorMapper
Class Inheritance
Imports
org.apache.pdfbox.cos.COSName, org.apache.pdfbox.pdmodel.PDDocument, .PDPageContentStream, org.apache.pdfbox.pdmodel.graphics.color.PDColor, .PDICCBased, java.awt.*, java.awt.color.ICC_ColorSpace, .ICC_Profile, java.io.IOException, .OutputStream

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

Field Summary

Modifier and TypeField and Description
private final ICC_ColorSpace
private final PDICCBased

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PDColor
mapColor(Color
the color to map
rgbColor
,
IPdfBoxGraphics2DColorMapper.IColorMapperEnv
the environment which allow getting the content stream, resources etc.
env
)

Overrides de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DColorMapper.mapColor.

Implements de.rototor.pdfbox.graphics2d.IPdfBoxGraphics2DColorMapper.mapColor.

Map the given Color to a PDColor

private static float[]
rgbIntToFloat(int[] rgbInts)

Field Detail

icc_colorspaceback to summary
private final ICC_ColorSpace icc_colorspace
pdProfileback to summary
private final PDICCBased pdProfile

Constructor Detail

RGBtoCMYKColorMapperback to summary
public RGBtoCMYKColorMapper(ICC_Profile icc_profile, PDDocument document) throws IOException

Method Detail

mapColorback to summary
public PDColor mapColor(Color rgbColor, IPdfBoxGraphics2DColorMapper.IColorMapperEnv env)

Overrides de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DColorMapper.mapColor.

Implements de.rototor.pdfbox.graphics2d.IPdfBoxGraphics2DColorMapper.mapColor.

Doc from de.rototor.pdfbox.graphics2d.IPdfBoxGraphics2DColorMapper.mapColor.

Map the given Color to a PDColor

Parameters
rgbColor:Color

the color to map

env:IPdfBoxGraphics2DColorMapper.IColorMapperEnv

the environment which allow getting the content stream, resources etc.

Returns:PDColor

the mapped color

Annotations
@Override
rgbIntToFloatback to summary
private static float[] rgbIntToFloat(int[] rgbInts)