public class

RedactionProcessor

extends Object
java.lang.Object
   ↳ com.pspdfkit.api.redaction.RedactionProcessor

Class Overview

A document processor to add and apply redactions. To identify content to redact it can search for content based upon regular expressions (RedactionRegEx), and use common information presets, e.g. phone numbers, email addresses. See RedactionPreset.Type for a list of presets.

Each instruction used to identify content to redact we will call a redaction template, of which a RedactionProcessor can use 1 or more to search for content to redact. To add a redaction template to the RedactionProcessor, (addRedactionTemplates(RedactionTemplate)) is called, which can be called multiple times with a variable argument list of redaction templates.

Once the required templates have been added it's possible to redact content directly with redact(PdfDocument) or redact(PdfDocument, WritableDataProvider). If desired redaction annotations can be added to the document but not applied, allowing for further processing or additional audits of content to be redacted before using save(DocumentSaveOptions) to apply the redactions.

The processor can take multiple calls to identifyAndAddRedactionAnnotations(PdfDocument) and redact(PdfDocument) to allow for batch processing on different documents.

Summary

Public Constructors
RedactionProcessor()
Public Methods
RedactionProcessor addRedactionTemplates(RedactionTemplate... redactionTemplates)
Appends the given redaction templates to the processor.
static RedactionProcessor create()
void identifyAndAddRedactionAnnotations(PdfDocument document)
For the given PdfDocument, use the redaction templates held by this RedactionProcessor to identify items to be redacted.
void redact(PdfDocument document, WritableDataProvider dataProvider)
For the given PdfDocument, use the redaction templates that the processor holds to identify and irreversibly remove the information from the document.
void redact(PdfDocument document)
For the given PdfDocument, use the redaction templates that the processor holds to identify and irreversibly remove the information from the document.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RedactionProcessor ()

Public Methods

public RedactionProcessor addRedactionTemplates (RedactionTemplate... redactionTemplates)

Appends the given redaction templates to the processor. When processing the document, redaction templates will be used in the order they were added.

Parameters
redactionTemplates Templates to append to the processor. Can be zero or more non-null values.

public static RedactionProcessor create ()

Returns

public void identifyAndAddRedactionAnnotations (PdfDocument document)

For the given PdfDocument, use the redaction templates held by this RedactionProcessor to identify items to be redacted. From tyhe identified information redaction annotations will be added to the document. The document will *NOT* yet have the redactions applied and sensitive information will still be present.

Parameters
document The document to add the redaction annotations.

public void redact (PdfDocument document, WritableDataProvider dataProvider)

For the given PdfDocument, use the redaction templates that the processor holds to identify and irreversibly remove the information from the document.

Parameters
document The document to redact.
dataProvider A data provider to write the redacted document.
Throws
IOException

public void redact (PdfDocument document)

For the given PdfDocument, use the redaction templates that the processor holds to identify and irreversibly remove the information from the document.

Parameters
document The document to redact.
Throws
IOException