Question

We are using PdfTable to layout text on a PDF document using iText. We would like to express the colors of the fonts as Pantone values. According to the documentation, you have to use PdfSpotColor to specify Pantone colors. The problem is that I have not found a way to set the font color of piece of text inside a table as a PdfSpotColor.

Is it at all to possible to set the font color as a PdfSpotColor?

Was it helpful?

Solution

PdfSpotColor extends basecolor so you can just use PdfSpotColor.

OTHER TIPS

If i understand your question correctly, you need to apply a color to a text inside a cell. Why don't you use java.awt.Color library ?

Color FONT_COLOR = new Color(192, 192, 192);

you can convert pantone colors to rgb from this site:

http://goffgrafix.com/pantone-rgb-100.php

Font cellFont;
cellFont = FontFactory.getFont("Arial", 24, Font.NORMAL, FONT_COLOR);

Now you can apply this color to the cell in the Pdfptable like this:

PdfPTable testTable = new PdfPTable(1);
Phrase title = new Phrase(new Chunk("TEST", cellFont));
PdfPCell testCell = new PdfPCell(title);
testTable.addCell(testCell);

Hope this helps. :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top