VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / GetFonts Methods / GetFonts() Method
Syntax Example Requirements SeeAlso
In This Topic
    GetFonts() Method (PdfDocument)
    In This Topic
    Returns a collection of fonts of this PDF document.
    Syntax

    Return Value

    The collection that contains all fonts of this PDF document.
    Example

    Here is an example that shows how to obtain information about all fonts of PDF document:

    
    ''' <summary>
    ''' Gets and prints information about fonts of PDF document.
    ''' </summary>
    ''' <param name="pdfFilename">The filename of PDF document.</param>
    Public Shared Sub PrintPdfFontsInfo(pdfFilename As String)
        ' open pdf document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
            ' get collection of font of PDF document
            Dim fonts As Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont() = document.GetFonts()
    
            ' print font count
            System.Console.WriteLine("Font count: {0}", fonts.Length)
            System.Console.WriteLine()
    
            ' for each font
            For Each font As Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont In fonts
                ' print name and type of font
                System.Console.WriteLine(vbTab & "Name: {0,-30} Type:{1}", font.FontName, font.FontType)
            Next
        End Using
    End Sub
    
    ' This code example produces the following output:
      Font count: 10
    '
          Name: XIMJKA+TTE11BB980t00           Type:TrueType
          Name: ANAPBW+TTE1198D80t00           Type:TrueType
          Name: MyriadPro-Regular              Type:Type1
          Name: IXDUSS+MyriadPro-Bold          Type:Type1
          Name: GZINQW+MyriadPro-Black         Type:Type1
          Name: SMICCY+MyriadPro-Regular       Type:Type1
          Name: IXDUSS+MinionPro-SemiboldIt    Type:Type1
          Name: IXDUSS+MinionPro-It            Type:Type1
          Name: IXDUSS+MinionPro-Bold          Type:Type1
          Name: YDDMIM+MinionPro-Regular       Type:Type1
      
    
    
    
    
    /// <summary>
    /// Gets and prints information about fonts of PDF document.
    /// </summary>
    /// <param name="pdfFilename">The filename of PDF document.</param>
    public static void PrintPdfFontsInfo(string pdfFilename)
    {
        // open pdf document
        using (Vintasoft.Imaging.Pdf.PdfDocument document = 
            new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
        {
            // get collection of font of PDF document
            Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont[] fonts = document.GetFonts();
    
            // print font count
            System.Console.WriteLine("Font count: {0}", fonts.Length);
            System.Console.WriteLine();
    
            // for each font
            foreach (Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont font in fonts)
                // print name and type of font
                System.Console.WriteLine("\tName: {0,-30} Type:{1}", font.FontName, font.FontType);
        }
    }
    
    /* This code example produces the following output:
    Font count: 10
    
        Name: XIMJKA+TTE11BB980t00           Type:TrueType
        Name: ANAPBW+TTE1198D80t00           Type:TrueType
        Name: MyriadPro-Regular              Type:Type1
        Name: IXDUSS+MyriadPro-Bold          Type:Type1
        Name: GZINQW+MyriadPro-Black         Type:Type1
        Name: SMICCY+MyriadPro-Regular       Type:Type1
        Name: IXDUSS+MinionPro-SemiboldIt    Type:Type1
        Name: IXDUSS+MinionPro-It            Type:Type1
        Name: IXDUSS+MinionPro-Bold          Type:Type1
        Name: YDDMIM+MinionPro-Regular       Type:Type1
    */
    
    

    Requirements

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

    See Also