ITextSharp text field sets the font to Bold

For a text box object, I would like to change the style to bold. I already created the arial font as it is not the default font for the BaseFont object. Apparently, the TextField object accepts only BaseFont as a valid font. I was wondering how to change the font style that I assigned to my text box in bold. Is there any way to do this? here is my code i still

TextField txtNewField = new TextField(stamp.Writer, new Rectangle(1, 1, 75, 25), "TxtField"); 
BaseFont arial = BaseFont.CreateFont(@"c:\windows\fonts\arial.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED); 
txtNewField.FontSize = 8; 
txtNewField.Font = arial; 

Thank you in advance!

+3
source share
1 answer

Did you try to specify arialbd.ttfas the font name? I think this will give better results since the bold font will be customized.

( , Font TextField, ...)

+5

Source: https://habr.com/ru/post/1759958/


All Articles