VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Pdf Namespace / PdfFontManager Class / EmbedAllFonts Method
Example



In This Topic
    EmbedAllFonts Method
    In This Topic
    Embeds all external fonts of the PDF document.
    Syntax
    'Declaration
     
    Public Sub EmbedAllFonts() 
    public void EmbedAllFonts()
    public: void EmbedAllFonts(); 
    public:
    void EmbedAllFonts(); 
    Example
    This example 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.Pdf.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.Pdf.FileFontProgramsController(true, pathToFonts);
            // embed all fonts
            document.FontManager.EmbedAllFonts();
            // pack and save document to new location
            document.Pack(resultFilename);
        }
    }
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also