CreateSimpleFontFromTrueTypeFont(String) Метод (PdfFontManager)
Создает простой шрифт на основе файла шрифта TrueType.
Вот пример, показывающий, как создать простой шрифт PDF, основанный на шрифте TrueType:
/// <summary>
/// Create font of PDF document based on TrueType font.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
/// <param name="trueTypeFontFilename">The filename of TrueType font.</param>
public static void CreateSimpleFont(string pdfFilename, string trueTypeFontFilename)
{
// open PDF document
using (Vintasoft.Imaging.Pdf.PdfDocument document =
new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
{
// create font of PDF document based on TrueType font
Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont newFont =
document.FontManager.CreateSimpleFontFromTrueTypeFont(trueTypeFontFilename);
//...
}
}
/// <summary>
/// Create font of PDF document based on TrueType font.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
/// <param name="trueTypeFontFilename">The filename of TrueType font.</param>
public static void CreateSimpleFont(string pdfFilename, string trueTypeFontFilename)
{
// open PDF document
using (Vintasoft.Imaging.Pdf.PdfDocument document =
new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
{
// create font of PDF document based on TrueType font
Vintasoft.Imaging.Pdf.Tree.Fonts.PdfFont newFont =
document.FontManager.CreateSimpleFontFromTrueTypeFont(trueTypeFontFilename);
//...
}
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5