Private Fonts

GemBox.Document enables you to specify the location where it should look for font files when loading a document from PDF, saving a document to PDF, XPS or image file formats, printing a document, or converting it to XpsDocument or ImageSource instances as in the following example.

This feature is especially useful for ASP.NET applications working in Medium Trust environment. By specifying a location that is under your ASP.NET application's control, GemBox.Document can use file system operations to retrieve font data even in Medium Trust environment.

By default, if location is not specified, GemBox.Document will look for font files in default font directory for the operating system.

Font file: Almonte Snow.ttf.

Private Fonts Screenshot
using GemBox.Document;

class Program
{
    static void Main()
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = new DocumentModel();

        FontSettings.FontsBaseDirectory = ".";

        document.DefaultCharacterFormat = new CharacterFormat()
        {
            FontName = "Almonte Snow",
            Size = 16
        };

        document.Sections.Add(
            new Section(document,
                new Paragraph(document, "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")

        Dim document As DocumentModel = New DocumentModel

        FontSettings.FontsBaseDirectory = "."

        document.DefaultCharacterFormat = New CharacterFormat() With
        {
            .FontName = "Almonte Snow",
            .Size = 16
        }

        document.Sections.Add(
            New Section(document,
                New Paragraph(document, "Hello World!")))

        document.Save("Private Fonts.%OutputFileType%")

    End Sub

End Module

Check next example or download examples from GitHub.