how set custom color using itext 7

Balagex picture Balagex · Sep 19, 2016 · Viewed 10.5k times · Source

I cannot find a solution for a very simple question, how can I set a custom color for a text/line/etc. using iText7 in java code?

I found this reply for iText5 but in version 7 there is no BaseColor class...

Answer

cao picture cao · Sep 21, 2016

I use this code to customize the text color:

com.itextpdf.kernel.color.Color myColor = new DeviceRgb(255, 100, 20);
Paragraph colorPara = new Paragraph("text with color").setFontColor(myColor);