VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / FontProgramsController Property
Syntax Exceptions Example Requirements SeeAlso
In This Topic
    FontProgramsController Property (PdfDocument)
    In This Topic
    Gets or sets FontProgramsControllerBase that allows to access external font programs.
    Syntax

    Property Value

    Default value is an instance of FileFontProgramsControllerWithFallbackFont class, which searches fonts in the "$ASSEMBLY_DIRECTORY$\fonts\" directory.
    Exceptions
    ExceptionDescription
    Thrown if value is null.
    Example

    Here is an example that shows how to change the font search algorithm and search fonts in the specified folder:

    
    ''' <summary>
    ''' Loads the PDF document and assigns custom fonts directory.
    ''' </summary>
    ''' <param name="filename">The name of PDF document.</param>
    ''' <returns>Loaded PDF document.</returns>
    Public Function LoadPdfDocumentAndSetFontsDictionary(filename As String) As Vintasoft.Imaging.Pdf.PdfDocument
        ' load PDF document
        Dim pdfDocument As New Vintasoft.Imaging.Pdf.PdfDocument(filename)
        ' define path to directory with custom fonts
        Dim directoryWithFonts As String = "d:\Environment\CustomFonts\"
        ' assign custom fonts directory
        pdfDocument.FontProgramsController = New Vintasoft.Imaging.Fonts.FileFontProgramsControllerWithFallbackFont(True, directoryWithFonts)
    
        Return pdfDocument
    End Function
    
    
    
    /// <summary>
    /// Loads the PDF document and assigns custom fonts directory.
    /// </summary>
    /// <param name="filename">The name of PDF document.</param>
    /// <returns>Loaded PDF document.</returns>
    public Vintasoft.Imaging.Pdf.PdfDocument LoadPdfDocumentAndSetFontsDictionary(string filename)
    {
        // load PDF document
        Vintasoft.Imaging.Pdf.PdfDocument pdfDocument = new Vintasoft.Imaging.Pdf.PdfDocument(filename);
        // define path to directory with custom fonts
        string directoryWithFonts = @"d:\Environment\CustomFonts\";
        // assign custom fonts directory
        pdfDocument.FontProgramsController = 
            new Vintasoft.Imaging.Fonts.FileFontProgramsControllerWithFallbackFont(true, directoryWithFonts);
    
        return pdfDocument;
    }
    
    

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also