Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

itextsharp 5.5.5 textcolor property is removed

Tags:

c#

pdf

itext

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?

like image 564
Babulaas Avatar asked Feb 11 '23 18:02

Babulaas


1 Answers

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);
like image 162
Robert Avatar answered Feb 13 '23 07:02

Robert