GetFonts() Метод (PdfDocument)
Возвращает коллекцию шрифтов этого PDF документа.
Return Value
Коллекция, содержащая все шрифты этого PDF документа.
Вот пример, показывающий, как получить информацию обо всех шрифтах PDF документа:
''' <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
*/
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5