EmbedAllFonts() Method (PdfFontManager)
Embeds all external fonts of the PDF document.
Here is an example that shows how to embed all external and standard fonts into PDF document:
''' <summary>
''' Embeds all fonts into PDF document.
''' </summary>
''' <param name="pdfFilename">The filename of PDF document.</param>
''' <param name="pathToFonts">The path to available fonts.</param>
''' <param name="resultFilename">The filename of resulting PDF document.</param>
Public Shared Sub EmbedAllFontsIntoDocument(pdfFilename As String, pathToFonts As String, resultFilename As String)
Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
' set a font programs controller
document.FontProgramsController = New Vintasoft.Imaging.Fonts.FileFontProgramsController(True, pathToFonts)
' embed all fonts
document.FontManager.EmbedAllFonts()
' pack and save document to new location
document.Pack(resultFilename)
End Using
End Sub
/// <summary>
/// Embeds all fonts into PDF document.
/// </summary>
/// <param name="pdfFilename">The filename of PDF document.</param>
/// <param name="pathToFonts">The path to available fonts.</param>
/// <param name="resultFilename">The filename of resulting PDF document.</param>
public static void EmbedAllFontsIntoDocument(string pdfFilename, string pathToFonts, string resultFilename)
{
using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
{
// set a font programs controller
document.FontProgramsController = new Vintasoft.Imaging.Fonts.FileFontProgramsController(true, pathToFonts);
// embed all fonts
document.FontManager.EmbedAllFonts();
// pack and save document to new location
document.Pack(resultFilename);
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5