VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Processing Namespace / PdfDocumentCompressorCommand Class / RemoveDuplicateResources Property
Syntax Example Requirements SeeAlso
In This Topic
    RemoveDuplicateResources Property (PdfDocumentCompressorCommand)
    In This Topic
    Gets or sets a value indicating whether the command must remove duplicate resources from PDF document.
    Syntax
    'Declaration
    
    <CategoryAttribute("Cleanup")>
    <DescriptionAttribute("A value indicating whether the command must remove duplicate resources.")>
    <DefaultValueAttribute(True)>
    Public Property RemoveDuplicateResources As Boolean
    
    
    [Category("Cleanup")]
    [Description("A value indicating whether the command must remove duplicate resources.")]
    [DefaultValue(True)]
    public bool RemoveDuplicateResources { get; set; }
    
    
    [Category("Cleanup")]
    [Description("A value indicating whether the command must remove duplicate resources.")]
    [DefaultValue(True)]
    public: __property bool get_RemoveDuplicateResources();
    public: __property void set_RemoveDuplicateResources(
    bool value
    );
    [Category("Cleanup")]
    [Description("A value indicating whether the command must remove duplicate resources.")]
    [DefaultValue(True)]
    public:
    property bool RemoveDuplicateResources { bool get(); void set(bool value); }

    Property Value

    True - command must remove duplicate resources; false - command must NOT remove duplicate resources.
    Default value is true.
    Example

    Here is an example that shows how to remove unused and duplicate resources in the PDF document:

    
    ''' <summary>
    ''' Removes unused and duplicated resources in the PDF document.
    ''' </summary>
    ''' <param name="inPdfFilename">The input PDF filename.</param>
    ''' <param name="outPdfFilename">The output PDF filename.</param>
    Public Shared Sub RemoveUnsusedResources(inPdfFilename As String, outPdfFilename As String)
        ' create compressor with empty compression settings
        Dim compressor As Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand = Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand.CreateEmptyCompressor()
    
        ' specify that compressor must remove duplicate resources from PDF document
        compressor.RemoveDuplicateResources = True
        ' specify that compressor must remove unused names resources from PDF document
        compressor.RemoveUnusedNamedResources = True
        ' specify that compressor must remove unused names from PDF document
        compressor.RemoveUnusedNames = True
        ' specify that compressor must remove unused pages from PDF document
        compressor.RemoveUnusedPages = True
        ' specify that compressor must remove invalid bookmarks from PDF document
        compressor.RemoveInvalidBookmarks = True
        ' specify that compressor must remove invalid links from PDF document
        compressor.RemoveInvalidLinks = True
    
        ' compress PDF document
        compressor.Compress(inPdfFilename, outPdfFilename)
    End Sub
    
    
    
    /// <summary>
    /// Removes unused and duplicated resources in the PDF document.
    /// </summary>
    /// <param name="inPdfFilename">The input PDF filename.</param>
    /// <param name="outPdfFilename">The output PDF filename.</param>
    public static void RemoveUnsusedResources(string inPdfFilename, string outPdfFilename)
    {
        // create compressor with empty compression settings
        Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand compressor =
           Vintasoft.Imaging.Pdf.Processing.PdfDocumentCompressorCommand.CreateEmptyCompressor();
    
        // specify that compressor must remove duplicate resources from PDF document
        compressor.RemoveDuplicateResources = true;
        // specify that compressor must remove unused names resources from PDF document
        compressor.RemoveUnusedNamedResources = true;
        // specify that compressor must remove unused names from PDF document
        compressor.RemoveUnusedNames = true;
        // specify that compressor must remove unused pages from PDF document
        compressor.RemoveUnusedPages = true;
        // specify that compressor must remove invalid bookmarks from PDF document
        compressor.RemoveInvalidBookmarks = true;
        // specify that compressor must remove invalid links from PDF document
        compressor.RemoveInvalidLinks = true;
    
        // compress PDF document
        compressor.Compress(inPdfFilename, outPdfFilename);
    }
    
    

    Requirements

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

    See Also