Redact PDFs in Our UWP Viewer

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. 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.

See our guide for customizing redaction button icons.