VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Processing Namespace / PdfDocumentCompressorCommand Class / RemoveMetadata Property
Syntax Example Requirements SeeAlso
In This Topic
    RemoveMetadata Property (PdfDocumentCompressorCommand)
    In This Topic
    Gets or sets a value indicating whether the command must remove metadata from PDF document.
    Syntax
    '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 - command must remove metadata; false - command must NOT remove metadata.
    Default value is false.
    Example

    Here is an example that shows how to remove metadata, bookmarks, document information, embedded files, embedded thumbnails, interactive form and structure tree of the PDF document:

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

    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