VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfFontManager Class / PackAllFonts Methods / PackAllFonts() Method
Syntax Example Requirements SeeAlso
In This Topic
    PackAllFonts() Method (PdfFontManager)
    In This Topic
    Packs all fonts of the PDF document.
    Syntax
    'Declaration
    
    Public Overloads Function PackAllFonts() As Boolean
    
    
    public bool PackAllFonts()
    
    
    public: bool PackAllFonts()
    
    
    public:
    bool PackAllFonts()

    Return Value

    True - font programs are packed successfully;
    false - font programs are NOT packed.
    Example

    Here is an example that shows how to pack all fonts of PDF document:

    
    
    ''' <summary>
    ''' Removes all unused characters from fonts of PDF document.
    ''' </summary>
    ''' <param name="pdfFilename">The filename of PDF document.</param>
    ''' <param name="resultFilename">The filename of resulting PDF document.</param>
    Public Shared Sub PackAllFontsOfDocument(pdfFilename As String, resultFilename As String)
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename)
            ' pack all fonts using progress controller
            document.FontManager.PackAllFonts()
            ' pack and save document to new location
            document.Pack(resultFilename)
        End Using
    End Sub
    
    
    
    
    
    /// <summary>
    /// Removes all unused characters from fonts of PDF document.
    /// </summary>
    /// <param name="pdfFilename">The filename of PDF document.</param>
    /// <param name="resultFilename">The filename of resulting PDF document.</param>
    public static void PackAllFontsOfDocument(string pdfFilename, string resultFilename)
    {
        using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(pdfFilename))
        {
            // pack all fonts using progress controller
            document.FontManager.PackAllFonts();
            // pack and save document to new location
            document.Pack(resultFilename);
        }
    }
    
    
    

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also