我们正在使用iText在PdfTable文档上设置文本布局。我们希望将字体的颜色表示为Pantone值。根据文档,您必须使用PdfSpotColor来指定Pantone颜色。问题是我还没有找到一种方法来将表格内文本的字体颜色设置为PdfSpotColor。
是否可以将字体颜色设置为PdfSpotColor?
发布于 2011-10-05 04:48:19
PdfSpotColor扩展了basecolor,所以你可以只使用PdfSpotColor。
发布于 2011-10-04 14:51:02
如果我没理解错的话,您需要对单元格中的文本应用颜色。为什么不使用java.awt.Color库呢?
Color FONT_COLOR = new Color(192, 192, 192);您可以从此站点将pantone颜色转换为rgb:
http://goffgrafix.com/pantone-rgb-100.php
Font cellFont;
cellFont = FontFactory.getFont("Arial", 24, Font.NORMAL, FONT_COLOR);现在,您可以将此颜色应用于Pdfptable中的单元格,如下所示:
PdfPTable testTable = new PdfPTable(1);
Phrase title = new Phrase(new Chunk("TEST", cellFont));
PdfPCell testCell = new PdfPCell(title);
testTable.addCell(testCell);希望这能有所帮助。:)
https://stackoverflow.com/questions/7644005
复制相似问题