VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / FontProgramsController Property
Example



In This Topic
    FontProgramsController Property (PdfDocument)
    In This Topic
    Gets or sets FontProgramsControllerBase that allows to access external font programs.
    Syntax
    'Declaration
     
    Public Property FontProgramsController As FontProgramsControllerBase
    public FontProgramsControllerBase FontProgramsController {get; set;}
    public: __property FontProgramsControllerBase* get_FontProgramsController();
    public: __property void set_FontProgramsController( 
       FontProgramsControllerBase* value
    );
    public:
    property FontProgramsControllerBase^ FontProgramsController {
       FontProgramsControllerBase^ get();
       void set (    FontProgramsControllerBase^ value);
    }

    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
    This example 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.Pdf.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.Pdf.FileFontProgramsControllerWithFallbackFont(true, directoryWithFonts);
                
        return pdfDocument;
    }
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also