Redaction is the process of removing content from a PDF page. This not only involves obscuring the content, but also removing the data in the document within the specified region.

Redaction is generally used when you want to remove personally identifiable or sensitive information from a document in order to ensure confidentiality and conform to regulations and privacy laws, such as GDPR or HIPAA. By using the Redaction component, the original content of a PDF can’t be restored, thereby guaranteeing privacy.

Redaction is a two-step process.

  • First, redaction annotations have to be created in the areas that should be redacted. This step won’t remove any content from the document yet; it just marks regions for redaction.

  • Second, to actually remove the content, the redaction annotations need to be applied. In this step, the page content within the region of the redaction annotations is irreversibly removed.

For further in-depth information, check out Adobe’s PDF Redaction: Addendum for the PDF Reference.

Creating Redactions Programmatically

Via Redaction Annotations

You can create redaction annotations programmatically via the Redaction annotation. Use the Rects property to set the regions that should be covered by the redaction annotation. Additionally, the BoundingBox needs to be set to a Windows.Foundation.Rect containing all the specified Rects.

You also have a few customization options for how a redaction should look, both while the redaction annotation is in its marked state, which is when it has been created but not yet applied, and in its redacted state, which is when the content is effectively redacted:

  • OverlayText can be used to set the text that should be displayed in a specified region when a redaction has been applied.

  • RepeatOverlayText defines whether the overlay text should be drawn once or repeated to fill the entire redaction area. This defaults to false, which means the overlay text is only drawn once. It has no effect if there is no overlay text specified.

  • Color can be used to change the color of the overlay text. It has no effect if there is no overlay text specified. This defaults to Windows.UI.Colors.Red.

  • FillColor specifies the background color of the redaction area after it has been applied. The color is drawn on all the specified Rects. This defaults to Windows.UI.Colors.Black.

  • OutlineColor specifies the color used for the redaction’s border in its marked state. This defaults to Windows.UI.Colors.Red.

It’s not possible to change the appearance once a redaction has been applied, since the redaction annotation will be removed from the document and the redaction will be part of the content of the document. This is an action that irreversibly replaces the original content under the specified region:

var boundingBox = new Rect(25, 25, 175, 30);

var redaction = new Redaction
    PageIndex = 0,
    BoundingBox = boundingBox,
    Rects = new List<Rect> { boundingBox },
    OverlayText = "REDACTED",
    Color = Colors.Orange

await PDFView.Document.CreateAnnotationAsync(redaction);

The redaction annotation created with the above code snippet would look like what’s shown in the image below.

Marked State
Redacted State

Redaction Properties

Once a redaction is added to a document, its properties and appearance can be customized via the annotation toolbar.

Toolbar options for redaction annotations

The properties under the Preview label affect the redacted appearance (i.e. how the document will look once redactions are applied), while the outline color picker only affects the marked appearance of the annotation.

Via Search Criteria

It’s possible to use PSPDFKit for Windows to automatically create redaction annotations based on specific search criteria. These could be text terms, custom regular expressions, or any of the built-in patterns PSPDFKit for Windows ships with.

Pdf.Document.CreateRedactionsBySearchAsync() allows you to specify the search criteria, along with specifying a custom redaction annotation to be used as a preset when creating redactions based on search results. By default, content inside annotations will also be included in the search results, but this can be adjusted with the SearchInAnnotations Boolean property inside the RedactionSearchOptions class.

Here’s an example showing how to redact all occurrences of PSPDFKit on a document, without including annotations:

var annotationIds = await PDFView.Document.CreateRedactionsBySearchAsync("PSPDFKit", SearchType.Text, new RedactionSearchOptions());

You can also use one of our built-in patterns to quickly identify sensitive information that needs to be redacted. Here’s an example of how to create redactions for every social security number found:

var annotationIds = await PDFView.Document.CreateRedactionsBySearchAsync(SearchPattern.SocialSecurityNumber, new RedactionSearchOptions());

The full list of available patterns can be found in our documentation for SearchPattern. For more information, please check our API documentation of Pdf.Document.CreateRedactionsBySearchAsync() and our Catalog example.

Creating Annotations with the User Interface

Toolbar Items

In addition to being able to create redactions programmatically, you can create and customize redactions via the UI that PSPDFKit for Windows provides.

For these, you have two toolbar items available: one for creating redactions by dragging the cursor around text Text highlighter redaction tool, and another one for drawing a rectangle over an arbitrary area Area redaction tool. In order to use these tools, you’ll need to set the toolbar items array appropriately (using PDFView.SetToolbarItemsAsync; more information can be found in our toolbar guide):

var toolbarItems = PDFView.GetToolbarItems();
toolbarItems.Add(new RedactTextHighlighterToolbarItem());
toolbarItems.Add(new RedactRectangleToolbarItem());

await PDFView.SetToolbarItemsAsync(toolbarItems);

Text Highlighter

When the text redaction tool Text highlighter redaction tool is active, you can drag a selection across regions of text and a new redaction annotation will be outlined throughout it. It works similar to how the text highlighter tool does.

Additionally, this interaction can be programmatically enabled by setting the PSPDFKit.UI.ViewState.InteractionMode property to InteractionMode.REDACT_TEXT_HIGHLIGHTER, which, after the PdfView has already loaded, can be done through the PdfView.Controller.SetInteractionModeAsync method.

Area Highlighter

When the area redaction tool Area redaction tool is active, you can draw a rectangle around the pages of the document and a new redaction annotation matching the region drawn will be added. It works similar to the tool used to create rectangle annotations.

Additionally, this tool can be programmatically enabled by setting the PSPDFKit.UI.ViewState.InteractionMode property to InteractionMode.REDACT_SHAPE_RECTANGLE.

Text Selection

Another way of creating a text redaction is by first selecting text and then choosing the redaction item from the contextual tooltip that appears.

Previewing Redactions

To preview redactions and see how they would look when applied without removing any document content, you can use the PdfView.PreviewRedactionsAsync() method, passing in true as its parameter:

await PDFView.Document.PreviewRedactionsAsync(true);

Applying Redactions

In order to actually redact the document after all the redaction annotations are added, you can call the Pdf.Document.ApplyRedactionsAsync() API method. This will overwrite the existing document, removing content irreversibly:

await PDFView.Document.ApplyRedactionsAsync();

The redaction annotations will be removed once the document has been redacted and the affected content has been removed. Any other existing annotations within the area of a redaction annotation are also removed.


PSPDFKit for Windows includes five redaction-related icons to help you better customize the interface of your application.

They can be located and used through the ms-appx-web:///PSPDFKit/Assets/Redactions/icon_name URI and are named as follows:

  • redaction.svg

  • redaction_preview.svg

  • redaction_personal_information.svg

  • redaction_string_matching.svg

  • redaction_string_search.svg

The icons make it easy to create custom toolbar buttons to better fit your needs. You can find a practical example on the redactions page of our UWP Catalog.

Redacting Graphic Objects Shared across Pages

Graphic objects — including images and vector graphics — can be reused across pages in a PDF. If a graphic object is redacted and reused, all instances of that graphic object will also be redacted.

This means that, for example, when you redact part of an image, the same part of the same image on another page will also be redacted. This is compatible with how Adobe Acrobat does it. A common example of this is if you have to redact a logo that is shown on each page.

❗Important: Even if the images look exactly the same, they could be separate images and not be redacted the same. Always be careful and review the redacted document when you’re done.


Redaction is a feature that has to be purchased separately. If it’s not part of the license, the APIs and UI changes mentioned above won’t function as described. The following list describes the expected behavior if Redaction is not part of your license: