> 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/ios/redaction/redact.md).

# Redact

Redact PDFs with Apryse: Learn how to securely remove sensitive content from documents using UI components or APIs. Control redaction style and ensure complete data removal for safe distribution. Expl

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 on iOS

## Overview

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 [`PTPDFViewCtrl`](/ios/basic-operations/open/view.md)) or programmatically (e.g. using `PTTextSearch` or `PTTextExtractor`). Up until the next step is performed, the user can see, move and redefine these redact annotations.
* Content removal: Using [`PTRedactor`](https://sdk.apryse.com/api/ios/Classes/PTRedactor.html) 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 a 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 framework comes with [`PTTextRedactionCreate`](https://sdk.apryse.com/api/ios/Classes/PTTextRedactionCreate.html) and [`PTRectangleRedactionCreate`](https://sdk.apryse.com/api/ios/Classes/PTRectangleRedactionCreate.html) tools that allow redaction on any region or through text selection.

| Text redaction                                                                                                                                                                                                                                   | Rectangular redaction                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ![](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%2Fuploads%2Fgit-blob-1def8e0ad93316f0dbfc23d94b87a8864759d179%2Fed44a757d3975b5ecad3bd9208c8303a446a7520-720x1280.gif?alt=media) | ![](https://4149080208-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgY6xtY9ZQd9XMpvWlGM0%2Fuploads%2Fgit-blob-a023d4dd1756444c6e7111c96a3c9b61826099a4%2Fd8a7e802ed091ed28750b6024247b4061fda5dcd-720x1280.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](/ios/get-started/samples.md)
* [`PTRedactor`](https://sdk.apryse.com/api/ios/Classes/PTRedactor.html) API reference
  {% endtab %}

{% tab title="API guide" %}

## API to programmatically redact PDFs on iOS

To redact content from a PDF document.

{% tabs %}
{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objc
PTVectorRedaction *vec = [[PTVectorRedaction alloc] init];
[vec add: [[PTRedaction alloc] initWithPage_num: 1 bbox: [[[PTPDFRect alloc] init] Set: 100 y1: 100 x2: 550 y2: 600] negative: NO text: @"Top Secret"]];
[vec add: [[PTRedaction alloc] initWithPage_num: 2 bbox: [[[PTPDFRect alloc] init] Set: 30 y1: 30 x2: 450 y2: 450] negative: YES text: @"Negative Redaction"]];
[vec add: [[PTRedaction alloc] initWithPage_num: 2 bbox: [[[PTPDFRect alloc] init] Set: 0 y1: 0 x2: 100 y2: 100] negative: NO text: @"Positive"]];
[vec add: [[PTRedaction alloc] initWithPage_num: 2 bbox: [[[PTPDFRect alloc] init] Set: 100 y1: 100 x2: 200 y2: 200] negative: NO text: @"Positive"]];
[vec add: [[PTRedaction alloc] initWithPage_num: 2 bbox: [[[PTPDFRect alloc] init] Set: 300 y1: 300 x2: 400 y2: 400] negative: NO text: @""]];
[vec add: [[PTRedaction alloc] initWithPage_num: 2 bbox: [[[PTPDFRect alloc] init] Set: 500 y1: 500 x2: 600 y2: 600] negative: NO text: @""]];
[vec add: [[PTRedaction alloc] initWithPage_num: 3 bbox: [[[PTPDFRect alloc] init] Set: 0 y1: 0 x2: 700 y2: 20] negative: NO text: @""]];
        
PTAppearance *app = [[PTAppearance alloc] init];
[app setRedactionOverlay: YES];
[app setBorder: NO];
[app setShowRedactedContentRegions: YES];

PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
[PTRedactor Redact: doc red_arr: vec app: app ext_neg_mode: NO page_coord_sys: YES];
```

{% endcode %}
{% endtab %}

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

```swift
let vec: PTVectorRedaction = PTVectorRedaction()
vec.add(PTRedaction(page_num: 1, bbox: PTPDFRect(x1: 100, y1: 100, x2: 550, y2: 600), negative: false, text: "Top Secret"))
vec.add(PTRedaction(page_num: 2, bbox: PTPDFRect(x1: 30, y1: 30, x2: 450, y2: 450), negative: true, text: "Negative Redaction"))
vec.add(PTRedaction(page_num: 2, bbox: PTPDFRect(x1: 0, y1: 0, x2: 100, y2: 100), negative: false, text: "Positive"))
vec.add(PTRedaction(page_num: 2, bbox: PTPDFRect(x1: 100, y1: 100, x2: 200, y2: 200), negative: false, text: "Positive"))
vec.add(PTRedaction(page_num: 2, bbox: PTPDFRect(x1: 300, y1: 300, x2: 400, y2: 400), negative: false, text: ""))
vec.add(PTRedaction(page_num: 2, bbox: PTPDFRect(x1: 500, y1: 500, x2: 600, y2: 600), negative: false, text: ""))
vec.add(PTRedaction(page_num: 3, bbox: PTPDFRect(x1: 0, y1: 0, x2: 700, y2: 20), negative: false, text: ""))

let app: PTAppearance = PTAppearance()
app.setRedactionOverlay(true)
app.setBorder(false)
app.setShowRedactedContentRegions(true)

let doc: PTPDFDoc = PTPDFDoc(filepath: filename)
PTRedactor.redact(doc, red_arr: vec, app: app, ext_neg_mode: false, page_coord_sys: true)
```

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

[PDF redaction](/ios/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/ios/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.
