Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Itext 7 Setting Font Color

Tags:

java

fonts

itext7

I am migrating from itext 5 to 7.0.5 and am having trouble with colors. When I try the following:

Text title1 = new Text("The Strange Case of ").setFontColor(Color.BLUE);

My IDE tells me that Color.BLUE is deprecated. I cannot find what to use instead. Please help. TIA.

like image 975
Wt Riker Avatar asked Dec 14 '22 19:12

Wt Riker


1 Answers

You should use com.itextpdf.kernel.color.ColorConstants as the replacement for com.itextpdf.kernel.color.Color which was marked depreciated in 7.0.5.

As noted in a comment the Color class is simply depreciated in 7.0.5 and both classes act the same way, however in 7.1 the Color class will be removed.

like image 114
Jon Reilly Avatar answered Dec 16 '22 09:12

Jon Reilly