FontProgramsController Property (PdfDocument)
Gets or sets
FontProgramsControllerBase that allows to access external font programs.
Property Value
Default value is an instance of
FileFontProgramsControllerWithFallbackFont class, which searches fonts in the "$ASSEMBLY_DIRECTORY$\fonts\" directory.
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;
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5