Redact PDFs in our UWP viewer
In addition to being able to create redactions programmatically, you can create and customize redactions via the UI Nutrient UWP SDK provides.
For these, you have two toolbar items available: one for creating redactions by dragging the cursor around text , and another one for drawing a rectangle over an arbitrary area . 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 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 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.