w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using Fonts in System with iTextSharp

1st you need to register the font and then just retrieve it from the FontFactory (and don't create it every time):

public static iTextSharp.text.Font GetTahoma()
{
    var fontName = "Tahoma";
    if (!FontFactory.IsRegistered(fontName))
    {
         var fontPath = Environment.GetEnvironmentVariable("SystemRoot") +
"\fonts\tahoma.ttf";
         FontFactory.Register(fontPath);
    }
    return FontFactory.GetFont(fontName, BaseFont.IDENTITY_H,
BaseFont.EMBEDDED); 
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.