CreateSimpleFontFromTrueTypeFont(String) Method (PdfFontManager)
Creates a simple font based on TrueType font file.
Here is an example that shows how to create a simple PDF font, which is based on TrueType font:
/// <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);
//...
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5