public class EraseMetadataRedaction extends MetadataRedaction
Represents a metadata redaction that erases all metadata or metadata matching specific MetadataFilters from the document.
Learn more
The following example demonstrates how to erase (set equal to empty values) all or specific metadata.
try (Redactor redactor = new Redactor("C:\\sample.docx"))
{
// Erase Author, Manager and Company
redactor.apply(new EraseMetadataRedaction(MetadataFilters.Author | MetadataFilters.Manager | MetadataFilters.Company));
// Erase all metadata
redactor.apply(new EraseMetadataRedaction(MetadataFilters.All));
redactor.save();
}
Constructor and Description |
---|
EraseMetadataRedaction()
Initializes a new instance of EraseMetadataRedaction class, erasing all metadata.
|
EraseMetadataRedaction(int filter)
Initializes a new instance of EraseMetadataRedaction class, erasing metadata, matching specific combination of
MetadataFilters . |
Modifier and Type | Method and Description |
---|---|
protected RedactorLogEntry |
applyTo(MetadataItem item,
IMetadataAccess metadata)
Applies the redaction to a given metadata item.
|
String |
getDescription()
Returns a string, describing the redaction and its parameters.
|
protected boolean |
isApplicableTo(MetadataItem item)
Checks if this redaction could be applied to a given metadata item.
|
applyFilter, applyTo, getFilter, setFilter
public EraseMetadataRedaction()
Initializes a new instance of EraseMetadataRedaction class, erasing all metadata.
public EraseMetadataRedaction(int filter)
Initializes a new instance of EraseMetadataRedaction class, erasing metadata, matching specific combination of MetadataFilters
.
filter
- Filter for metadata to erasepublic String getDescription()
Returns a string, describing the redaction and its parameters.
getDescription
in class Redaction
protected boolean isApplicableTo(MetadataItem item)
Checks if this redaction could be applied to a given metadata item.
isApplicableTo
in class MetadataRedaction
item
- Metadata itemprotected RedactorLogEntry applyTo(MetadataItem item, IMetadataAccess metadata)
Applies the redaction to a given metadata item.
applyTo
in class MetadataRedaction
item
- Metadata itemmetadata
- Metadata access