Private Fonts
GemBox.Document provides the FontSettings
class for specifying various font related options which are used by a rendering engine when saving a document to PDF, XPS or image formats, printing a document or converting a document to XpsDocument
or ImageSource
objects.
For example, using the FontSettings.FontsBaseDirectory
property you can specify the location where GemBox.Document's rendering engine can look for the document's font files. This feature is especially useful for medium trust environments, like ASP.NET applications working in Medium Level Trust, where accessing the default font directory for the operating system is restricted.
The following example shows how you can specify the location of a custom font (in this case it contains the Almonte Snow.ttf font file).

using GemBox.Document;
class Program
{
static void Main()
{
// If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
FontSettings.FontsBaseDirectory = ".";
var document = new DocumentModel();
document.DefaultCharacterFormat.FontName = "Almonte Snow";
document.DefaultCharacterFormat.Size = 48;
document.Content.LoadText("Hello World!");
document.Save("Private Fonts.%OutputFileType%");
}
}
Imports GemBox.Document
Module Program
Sub Main()
' If using Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
FontSettings.FontsBaseDirectory = "."
Dim document As New DocumentModel()
document.DefaultCharacterFormat.FontName = "Almonte Snow"
document.DefaultCharacterFormat.Size = 48
document.Content.LoadText("Hello World!")
document.Save("Private Fonts.%OutputFileType%")
End Sub
End Module
GemBox.Document also supports retrieving fonts that are stored as resources inside the local or referenced assembly by specifying the FontSettings.FontsBaseResourceLocation
property. Note; under this property's remarks you can find out how you can use embedded fonts.