Stamper and Color Modes

We are using the Stamper class as follows:

Font font = Font.createTrueTypeFont(thisDoc,this.getClass().getResourceAsStream(fontLocation), true, true);
Stamper s = new Stamper(Stamper.e_font_size, fontSize, 0);
s.setFontColor(new ColorPt(0, 0, 0, 1));

We are trying to produce PDF/X-1a compliant output but the resulting font seems to end with an RGB color mode. We were hoping “s.setFontColor(new ColorPt(0, 0, 0, 1));” would cause the CMYK color mode to be used. Are we improperly setting the font color or is the Stamper the wrong tool for the job.


Hello Brian,

Stamper will only stamp text in RGB. One option may be for you to create CMYK text in a new PDF page and then use Stamper.StampPage() instead of StampText():

Please let me know whether this helps and if you have any further questions.

Thank you. Would using ElementEdit make more sense for altering existing pages?

Depends on what are your requirements. ElementEdit is a relatively low-level option
A bit more high-level option is ContentReplacer … as shown in ContentReplacer sample: