I have updated my itextsharp for 4.x.x to 5.5.5 (latest version) However the following line will give an error:
Font heading1 = new Font(bfTimes, 16, Font.BOLD, Color.BLACK);
Error: The name'Color' does not exist in the current context
itextsharp.text.font.color is removed from the new version.
How do I set the color in the new itextsharp version?
You can set the color like this:
var color = new BaseColor(255, 0, 0); //or BaseColor.RED
var font = FontFactory.GetFont(bfTimes, 16, Font.BOLD, color);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With