var htmlarraylist = HTMLWorker.ParseToList(new StringReader(htmlText), styles);
document.Open();
BaseFont Vn_Helvetica = BaseFont.CreateFont(@"C:\Windows\Fonts\arial.ttf",
"Identity-H", BaseFont.EMBEDDED);
Font fontNormal = new Font(Vn_Helvetica, 12, Font.NORMAL);
foreach (var t in htmlarraylist)
{
document.Add((IElement)t);
//how set FontNormal if element is Paragraph?
}
document.Close();
Can someone help me please
You can use a font in iTextSharp using
FontFactory.RegisterDirectories();
Font fontNormal = new Font(FontFactory.GetFont("Arial", 12, Font.NORMAL))
You should be able to set the font on a paragraph using the following:
foreach (var t in htmlarraylist)
{
if(t is Paragraph)
{
((Paragraph)t).Font = fontNormal;
}
document.Add((IElement)t);
}
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