我們使用PdfTable來使用iText在PDF文檔上排列文本。我們希望將字體的顏色表示爲Pantone值。根據文檔,你必須使用PdfSpotColor來指定Pantone顏色。問題是,我還沒有找到一種方法來設置表格內的文字的字體顏色爲PdfSpotColor。iText:PdfSpotColor with PdfTable
是否可以將字體顏色設置爲PdfSpotColor?
我們使用PdfTable來使用iText在PDF文檔上排列文本。我們希望將字體的顏色表示爲Pantone值。根據文檔,你必須使用PdfSpotColor來指定Pantone顏色。問題是,我還沒有找到一種方法來設置表格內的文字的字體顏色爲PdfSpotColor。iText:PdfSpotColor with PdfTable
是否可以將字體顏色設置爲PdfSpotColor?
PdfSpotColor擴展basecolor,所以你可以使用PdfSpotColor。
如果我正確理解您的問題,您需要將顏色應用於單元格內的文本。爲什麼不使用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);
希望這有助於。 :)
謝謝,Hashim R,爲您的迴應。但是我們需要指定專色,因爲我們正在開發一個打印應用程序,我們需要在PDF上指定專色。 – vodkadrinksyou