Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ItextSharp (Itext) - set custom font for paragraph

I am trying to set custom font to Paragraph, but I can't make it work. I tried setting .Font= , but it only works size-wise, but it ignores font. Could you please assist?

Paragraph T = new Paragraph(newTempLine);
iTextSharp.text.Font contentFont = iTextSharp.text.FontFactory.GetFont("Webdings", 12, iTextSharp.text.Font.NORMAL);
T.Font = contentFont;
myDocument.Add(T);
like image 278
Andrew Avatar asked Feb 04 '12 22:02

Andrew


1 Answers

Set it in the constructor:

Font contentFont = FontFactory.GetFont(…);
Paragraph para = new Paragraph(newTempLine, contentFont);
like image 64
millimoose Avatar answered Sep 20 '22 18:09

millimoose