Skip to end of metadata
Go to start of metadata
Contents Summary
 

The code in below examples uses some methods defined in the Common Utilities.

Filter Metadata

Using GroupDocs.Redaction API, you can filter document metadata using MetadataFilter tag. You can set the filter to All, or any combination of metadata. Following is the table with the full list of MetadataFilter items: 

Filter
Numeric value
Description

Version

262144Document's version

TotalEditingTime

131072Total editing time

Title

65536Document title

Template

32768Document template name

Subject

16384Subject of the document

RevisionNumber

8192Revision number
None0Empty filter setting, matches no metadata items

NameOfApplication

2048Name of application where the document was created

Manager

4096Author's manager name

LastSavedTime

1024Last saved date and time

LastSavedBy

256Last saved by user

LastPrinted

128Last printed date and time

Keywords

1048576Document's keywords

HyperlinkBase

64Hyperlink base

Description

524288Document's description

CreatedTime

32Created time

ContentType

2097152Content type

ContentStatus

16Content status

Company

8Company of the Author

Comments

4Document comment

Category

2Category of the document

Author

1Author of the document

All

4194304All types of the metadata items

The Recipe

  • Load Document using Redactor.Load(@"C:\sample.docx")

  • Filter Author, Manager, and NameOfApplication using RDocument.RedactWith(new EraseMetadataRedaction(MetadataFilter.Author | MetadataFilter.Manager | MetadataFilter.NameOfApplication))

  • Save document in it's original format using Document.(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false })

The Code

Clean Metadata

Using GroupDocs.Redaction API, you can clean document metadata using MetadataFilter tag. 

The Recipe

  • Load Document using Redactor.Load(@"C:\sample.docx")

  • Clean metadata using Document.RedactWith(new EraseMetadataRedaction(MetadataFilter.Author | MetadataFilter.Manager | MetadataFilter.NameOfApplication))

  • Save document in it's original format using Document.(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false })

The Code

Metadata Search Redaction 

Using GroupDocs.Redaction API, You can use MetadataSearchRedaction to remove sensitive data from document's metadata using regular expressions. For example you can remove any mention of "Company Ltd." 

The Recipe

  • Load Document using Redactor.Load(@"C:\sample.docx")

  • Perform metadata search redaction using Document.RedactWith(new MetadataSearchRedaction("Company Ltd.", "--company--"))

  • Save document in it's original format using Document.(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false })

The Code

Metadata Search Redaction Using Filters

Using GroupDocs.Redaction API, you can also set scope for redaction by setting filter, e.g. to MetadataFilter.Company. It will leave the regular expressions matches undone in all metadata items, except "Company" property.

The Recipe

  • Load Document using Redactor.Load(@"C:\sample.docx")

  • Initialize MetadataSearchRedaction using new MetadataSearchRedaction("Company Ltd.", "--company--"){ Filter = MetadataFilter.Company}

  • Perform metadata search redaction using Document.RedactWith(MetadataSearchRedaction)

  • Save document in it's original format using Document.(new SaveOptions() { AddSuffix = true, RasterizeToPDF = false })

The Code

Labels
  • No labels