RemoveDuplicateResources Property (PdfDocumentCompressorCommand)
Gets or sets a value indicating whether the command must remove duplicate resources from PDF document.
Property Value
True - command must remove duplicate resources; false - command must NOT remove duplicate resources.
Default value is true.
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);
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5