VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Pdf Namespace / PdfFontManager Class / GetStandardFont Method
Standard font type.
Example



In This Topic
    GetStandardFont Method (PdfFontManager)
    In This Topic
    Returns the standard font of specified type.
    Syntax
    'Declaration
     
    Public Function GetStandardFont( _
       ByVal standardFontType As PdfStandardFontType _
    ) As PdfFont
    public PdfFont GetStandardFont( 
       PdfStandardFontType standardFontType
    )
    public: PdfFont* GetStandardFont( 
       PdfStandardFontType standardFontType
    ) 
    public:
    PdfFont^ GetStandardFont( 
       PdfStandardFontType standardFontType
    ) 

    Parameters

    standardFontType
    Standard font type.

    Return Value

    Exceptions
    ExceptionDescription
    Thrown if standardFontType is not one of the standard 14 PDF font types.
    Example
    This example 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: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also