GetStandardFont(PdfStandardFontType) Метод (PdfFontManager)
Возвращает стандартный шрифт указанного типа.
Вот пример, показывающий, как создать шрифт PDF, основанный на стандартном шрифте Times-Roman:
''' <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);
//...
}
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5