> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/redaction/redact.md).

# Redact

Learn how to redact PDFs in Android using UI components or APIs with Apryse. Safely remove sensitive content for secure distribution. Explore the redaction process and control options. The Apryse Andr

There are two options to perform redaction. First is using a UI component that provides tools to select text or create regions interactively. Second is an API guide to programmatically apply redactions.

{% tabs %}
{% tab title="UI component" %}

## Redact PDFs in Android

Redaction typically involves removing sensitive content within documents for safe distribution to courts, patent and government institutions, the media, customers, vendors or any other audience with restricted access to the content. The redaction process in Apryse consists of two steps:

* Content identification: A user applies redact annotations that specify the pieces or regions of content that should be removed. The content for redaction can be identified either interactively (e.g. using `PDFViewCtrl`) or programmatically (e.g. using `TextSearch` or `TextExtractor`). Up until the next step is performed, the user can see, move and redefine these annotations.
* Content removal: Using `Redactor.Redact()` the user instructs Apryse to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.).

Apryse Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion of the image or path data is destroyed and is not simply hidden with clipping or image masks.

Apryse API can also be used to review and remove metadata and other content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content.

## Built-in redaction tool

The Tools package comes with a [`TextRedactionCreate`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/tools/TextRedactionCreate.html) tool and a [`RectRedactionCreate`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/tools/RectRedactionCreate.html) tool that allow redaction on any region or through text selection.

| Text redaction                                                                                                                                                                                                                                  | Rectangular redaction                                                                                                                                                                                                                           |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-7dd181f699b10055869626ab85d0b01844e04b02%2F40be22fae82efacf6ab849e0eccd6cb694107582-600x1191.gif?alt=media) | ![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-ca67355d0812f1495675171f56ff85c7bc1b031b%2Fd309b79ada7eb224c9433589bf6629fb851176ab-600x1191.gif?alt=media) |

The built-in redaction tool will continue to improve in the near future.

## Next steps

Keep in mind that Apryse's redact feature can do much more! See related topics here:

* [Redact sample](/android/get-started/samples/pdfredacttest.md)
* [`Redactor`](https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/Redactor.html) API reference
  {% endtab %}

{% tab title="API guide" %}

## API to programmatically redact PDFs in Android

To redact content from a PDF document.

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Redactor.Redaction[] rarr = new Redactor.Redaction[7];
rarr[0] = new Redactor.Redaction(1, new Rect(100, 100, 550, 600), false, "Top Secret");
rarr[1] = new Redactor.Redaction(2, new Rect(30, 30, 450, 450), true, "Negative Redaction");
rarr[2] = new Redactor.Redaction(2, new Rect(0, 0, 100, 100), false, "Positive");
rarr[3] = new Redactor.Redaction(2, new Rect(100, 100, 200, 200), false, "Positive");
rarr[4] = new Redactor.Redaction(2, new Rect(300, 300, 400, 400), false, "");
rarr[5] = new Redactor.Redaction(2, new Rect(500, 500, 600, 600), false, "");
rarr[6] = new Redactor.Redaction(3, new Rect(0, 0, 700, 20), false, "");

Redactor.Appearance app = new Redactor.Appearance();
app.redactionOverlay = true;
app.border = false;
app.showRedactedContentRegions = true;

PDFDoc doc = new PDFDoc(filename);
Redactor.redact(doc, rarr, app, false, true);
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
val rarr = arrayOfNulls<Redactor.Redaction>(6)
rarr[0] = Redactor.Redaction(1, Rect(0.0, 0.0, 600.0, 600.0), false, "Top Secret")
rarr[1] = Redactor.Redaction(2, Rect(0.0, 0.0, 100.0, 100.0), false, "foo")
rarr[2] = Redactor.Redaction(2, Rect(100.0, 100.0, 200.0, 200.0), false, "bar")
rarr[3] = Redactor.Redaction(2, Rect(300.0, 300.0, 400.0, 400.0), false, "")
rarr[4] = Redactor.Redaction(2, Rect(500.0, 500.0, 600.0, 600.0), false, "")
rarr[5] = Redactor.Redaction(3, Rect(0.0, 0.0, 700.0, 20.0), false, "")

val app = Redactor.Appearance()
app.redactionOverlay = true
app.border = false
app.showRedactedContentRegions = true

val doc = PDFDoc(filename)
Redactor.redact(doc, rarr, app, false, true)
```

{% endcode %}
{% endtab %}
{% endtabs %}

[PDF redaction](/android/get-started/samples.md#pdfredact) Full code sample which shows how to use `pdftron.PDF.Redactor` to remove potentially sensitive content within PDF documents.

## About redactor

Apryse Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion of the image or path data is destroyed and is not hidden with clipping or image masks. Apryse SDK API can also be used to review and remove metadata and other content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content.

The redaction process in Apryse SDK consists of two steps:

**1. Content identification** A user applies redact annotations that specify the pieces or regions of content that should be removed. The content for redaction can be identified either interactively (e.g. using ‘pdftron.PDF.PDFViewCtrl’ as shown in PDFView sample) or programmatically (e.g. using ‘pdftron.PDF.TextSearch’ or ‘pdftron.PDF.TextExtractor’). Up until the next step is performed, the user can see, move and redefine these annotations.

**2. Content removal** Using ‘pdftron.PDF.Redactor.Redact()’ the user instructs Apryse SDK to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.).
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/android/redaction/redact.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
