PDF .NET Library Logo
Home Products Code Library Online Demos Support Forum Buy About Us  
Code Library

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.");

doc.Save();

Back to PDF Code Library