VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Processing Namespace / PdfDocumentCompressorCommand Class / RemoveMetadata Property
Синтаксис Example Требования Смотрите также
В этом разделе
    RemoveMetadata Свойство (PdfDocumentCompressorCommand)
    В этом разделе
    Возвращает или задает значение, указывающее, должна ли команда удалять метаданные из PDF документа.
    Синтаксис
    'Declaration
    
    <DefaultValueAttribute(False)>
    <DescriptionAttribute("A value indicating whether the command must remove metadata.")>
    <CategoryAttribute("Discard")>
    Public Property RemoveMetadata As Boolean
    
    
    [DefaultValue(False)]
    [Description("A value indicating whether the command must remove metadata.")]
    [Category("Discard")]
    public bool RemoveMetadata { get; set; }
    
    
    [DefaultValue(False)]
    [Description("A value indicating whether the command must remove metadata.")]
    [Category("Discard")]
    public: __property bool get_RemoveMetadata();
    public: __property void set_RemoveMetadata(
    bool value
    );
    [DefaultValue(False)]
    [Description("A value indicating whether the command must remove metadata.")]
    [Category("Discard")]
    public:
    property bool RemoveMetadata { bool get(); void set(bool value); }

    Property Value

    True - команда должна удалять метаданные; false - команда НЕ должна удалять метаданные.
    Значение по умолчанию: false.
    Пример

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

    
    ''' <summary>
    ''' Removes metadata, bookmarks, document information, embedded files, embedded thumbnails, interactive form and structure tree of the PDF document.
    ''' </summary>
    ''' <param name="inPdfFilename">The input PDF filename.</param>
    ''' <param name="outPdfFilename">The output PDF filename.</param>
    Public Shared Sub RemoveObjects(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 metadata from PDF document
        compressor.RemoveMetadata = True
        ' specify that compressor must remove bookmarks from PDF document
        compressor.RemoveBookmarks = True
        ' specify that compressor must remove document information from PDF document
        compressor.RemoveDocumentInformation = True
        ' specify that compressor must remove embedded files from PDF document
        compressor.RemoveEmbeddedFiles = True
        ' specify that compressor must remove embedded thumbnails from PDF document
        compressor.RemoveEmbeddedThumbnails = True
        ' specify that compressor must remove interactive form from PDF document
        compressor.RemoveInteractiveForm = True
        ' specify that compressor must remove structure tree from PDF document
        compressor.RemoveStructureTree = True
    
        ' compress PDF document
        compressor.Compress(inPdfFilename, outPdfFilename)
    End Sub
    
    
    
    /// <summary>
    /// Removes metadata, bookmarks, document information, embedded files, embedded thumbnails, interactive form and structure tree of the PDF document.
    /// </summary>
    /// <param name="inPdfFilename">The input PDF filename.</param>
    /// <param name="outPdfFilename">The output PDF filename.</param>
    public static void RemoveObjects(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 metadata from PDF document
        compressor.RemoveMetadata = true;
        // specify that compressor must remove bookmarks from PDF document
        compressor.RemoveBookmarks = true;
        // specify that compressor must remove document information from PDF document
        compressor.RemoveDocumentInformation = true;
        // specify that compressor must remove embedded files from PDF document
        compressor.RemoveEmbeddedFiles = true;
        // specify that compressor must remove embedded thumbnails from PDF document
        compressor.RemoveEmbeddedThumbnails = true;
        // specify that compressor must remove interactive form from PDF document
        compressor.RemoveInteractiveForm = true;
        // specify that compressor must remove structure tree from PDF document
        compressor.RemoveStructureTree = 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

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