How to use Verdana Font in Stamper (iText PDF)

后端 未结 2 970
忘掉有多难
忘掉有多难 2021-01-20 19:45

I want to use Verdana as a font while stamping a PDF file with iText PDF. The original file uses Verdana, which isn\'t an option in the class Basefont.

Here is the f

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-20 19:53

    Adding this line makes sure the FontFactory actually registers the fonts in the operating systems' default fonts directories:

    FontFactory.RegisterDirectories();
    

    After that all the installed fonts can be found using something like

    var myfont = FontFactory.GetFont("Verdana", 10f, iTextSharp.text.Font.NORMAL);
    

    I get that this post is old, but it's still relevant I guess.

提交回复
热议问题