VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfFontManager Class / GetStandardFont(PdfStandardFontType) Method
Syntax Exceptions Example Requirements SeeAlso
In This Topic
    GetStandardFont(PdfStandardFontType) Method (PdfFontManager)
    In This Topic
    Returns the standard font of specified type.
    Syntax
    Exceptions
    ExceptionDescription
    Thrown if standardFontType is not one of the standard 14 PDF font types.
    Example

    Here is an example that shows how to create a PDF font, which is based on standard Times-Roman font:

    
    ''' <summary>
    ''' Creates font of PDF document based on "Times-Roman".
    ''' </summary>
    ''' <param name="pdfFilename">The filename of PDF document.</param>
    Public Shared Sub CreateStandartFont(pdfFilename As String)
        ' open PDF document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
            ' create font based on "Times-Roman" font
                '...
            Dim timesRomanFont As Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont = document.FontManager.GetStandardFont(Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman)
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Creates font of PDF document based on "Times-Roman".
    /// </summary>
    /// <param name="pdfFilename">The filename of PDF document.</param>
    public static void CreateStandartFont(string pdfFilename)
    {
        // open PDF document
        using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
        {
            // create font based on "Times-Roman" font
            Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont timesRomanFont = document.FontManager.GetStandardFont(
                Vintasoft.Imaging.Pdf.Tree.Fonts.PdfStandardFontType.TimesRoman);
            //...
        }
    }
    
    

    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