Redacting PDFs in Android viewer
Use Nutrient’s built-in UI to create, customize, preview, and apply redactions.
Adding redactions
To mark text for redaction, follow these steps:
- Select the redaction tool on the annotation toolbar.
- Drag across the text.
- Lift your finger to create the redaction annotation.

Alternatively, select text first. Then tap the redaction item in the selection menu.

Use the annotation inspector to customize a redaction annotation’s properties and appearance.

Applying redactions
PdfActivity and PdfUiFragment display a floating Redaction button when the document contains redaction annotations. To apply redactions, follow these steps:
- Tap Redaction.
- Tap Apply Redactions.
- Choose whether to overwrite the document or save a new copy.
Applying redactions permanently removes the marked content and the redaction annotations.
To remove the annotations without redacting content, tap Clear Redactions. The regular undo button can reverse this clearing operation.
When opening a document, Nutrient checks for existing redaction annotations before displaying the button. This check can delay its appearance.

Previewing redactions
Preview mode displays redaction annotations as they’ll appear after redaction, instead of their default marked appearance. To enable preview mode, follow these steps:
- Tap the floating Redaction button.
- Tap Enable Redaction Preview.
Previewing doesn’t remove content. Only applying redactions removes content from the document.

Custom redaction UI
To replace the built-in UI, disable the floating button with PdfActivityConfiguration.Builder#setRedactionUiEnabled(), and provide your own UI to indicate pending redactions, preview them, and apply them.