Akki
Akki

Reputation: 61

ItextSharp-How to give Color and Bold to paragraph

Phrase p1Header = new Phrase("Hello World", FontFactory.GetFont("verdana", 15, Font.BOLD));

It just makes Hello World bold. I want to give the color to it as well.

Upvotes: 2

Views: 12571

Answers (2)

sonicbabbler
sonicbabbler

Reputation: 851

Define the font and add to the Paragraph

iTextSharp.text.Font myFont= FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(0, 0, 255));
Paragraph myParagraph = new Paragraph("MyField", myFont);

Upvotes: 0

Anshu
Anshu

Reputation: 374

Try the following.

Phrase p1Header = new Phrase("Hello World",FontFactory.GetFont("Times New Roman", 10, Font.BOLD, new Color(255, 255, 255)));

Upvotes: 2

Related Questions