PDF .NET Library Logo

Setting an alternate Font Directory

The code sample retrieves fonts from an alternate font directory. This feature allows you to retrieve fonts from an alternate location instead of the default windows font directory. This function is a life saver in restricted hosting environments.

C# sample:

PDFCreationOptions options = new PDFCreationOptions();

options.FontDirectory = "c:\\MyFontDirectory";

PDFDocument doc = new PDFDocument("sample.pdf", options);

doc.CurrentPage.Body.SetActiveFont("Tahoma", PDFFontStyles.Regular, 12);

doc.CurrentPage.Body.AddText("sample text.");


Back to PDF Code Library