GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API.

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.

Screenshot
Private Fonts Screenshot

See the full code below, use Run Example to execute.

using System;
using System.IO;
using System.Text;
using GemBox.Document;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = new DocumentModel();

        string pathToResources = "Resources";

        FontSettings.FontsBaseDirectory = pathToResources;

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

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

        document.Save("Private Fonts.pdf");
    }
}
Imports System
Imports System.IO
Imports System.Text
Imports GemBox.Document

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document As DocumentModel = New DocumentModel

        Dim pathToResources As String = "Resources"

        FontSettings.FontsBaseDirectory = pathToResources

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

    End Sub

End Module

Check next sample.