VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Processing Namespace / PdfDocumentCompressorCommand Class / RemoveDuplicateResources Property
Синтаксис Example Требования Смотрите также
В этом разделе
    RemoveDuplicateResources Свойство (PdfDocumentCompressorCommand)
    В этом разделе
    Возвращает или задает значение, указывающее, должна ли команда удалять дубликаты ресурсов из PDF документа.
    Синтаксис
    '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 - команда должна удалять дубликаты ресурсов; false - команда НЕ должна удалять дубликаты ресурсов.
    Значение по умолчанию: true.
    Пример

    Вот пример, показывающий, как удалить неиспользуемые и дубликаты ресурсов в PDF документе:

    
    ''' <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);
    }
    
    

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также