Introduction
MuPDF Android App Kit
MuPDF iOS App Kit
Download App Kit

PDF Redactions

Redactions

The redaction feature has been designed to work on text, images, and links. By selecting all or part of an image, text, or link, and applying redaction this then permanently redacts the selected information, making it impossible to retrieve the original data.

Redacted text and areas can be marked, and any marked redactions can be removed, however once the redactions are applied and the document is saved then the redacted information is blocked out with black to denote the area of redaction. At this point the original text and/or area is unretrievable.

Example

marked for redaction redaction applied
Text marked for redaction Redaction applied

Marking text for redaction

To mark text for redaction call the redactMarkText() method against the DocumentView instance. The document's currently selected text will then be marked with a red-outlined box to denote the redaction demarcation.

Kotlin
import com.artifex.sonui.editor.DocumentView

fun markForTextRedaction(documentView:DocumentView) {
    documentView.redactMarkText()
}
Java
import com.artifex.sonui.editor.DocumentView;

public void markForTextRedaction(documentView:DocumentView) {
    documentView.redactMarkText();
}

Marking an area for redaction

To mark an area for redaction call the redactMarkArea() method against the DocumentView instance. The document will then enter a mode whereby the user can then draw a red-outlined boxed area to denote the redaction demarcation.

Kotlin
import com.artifex.sonui.editor.DocumentView

fun markForAreaRedaction(documentView:DocumentView) {
    documentView.redactMarkArea()
}
Java
import com.artifex.sonui.editor.DocumentView;

public void markForAreaRedaction(documentView:DocumentView) {
    documentView.redactMarkArea();
}

Removing a marked redaction

To remove a marked redaction call the redactRemove() method against the DocumentView instance. The document's currently selected marked for redaction ( i.e. a selection of text or an area with the red box outline ) will then no longer be marked for redaction.

Kotlin
import com.artifex.sonui.editor.DocumentView

fun removeMarkForRedaction(documentView:DocumentView) {
    documentView.redactRemove()
}
Java
import com.artifex.sonui.editor.DocumentView;

public void removeMarkForRedaction(documentView:DocumentView) {
    documentView.redactRemove();
}

Applying redactions

Applying redactions means that all document selections which are marked for redaction will be redacted. To apply redactions call the redactApply() method against the DocumentView instance. Once redactions have been applied then the redacted text is blocked out with black and the red redaction demarcation areas are removed.

Kotlin
import com.artifex.sonui.editor.DocumentView

fun applyRedactions(documentView:DocumentView) {
    documentView.redactApply()
}
Java
import com.artifex.sonui.editor.DocumentView;

public void applyRedactions(documentView:DocumentView) {
    documentView.redactApply();
}

NOTE
Redactions are not permanently set until the document is saved. If the document is exited without saving then the redactions will be lost.