Skip to Content
NexPDF

Redaction

Permanently remove text, images and annotations from the document shown in a .NET MAUI PdfView.

English

License module

Redaction needs the redaction module (Business tier and above).

Redaction is destructive: the text, images and annotations under the area are removed from the file, not just covered, and an opaque box is painted over it.

var doc = view.Document!;

doc.ApplyRedaction(view.CurrentPage, 72, 600, 300, 620, 0);   // page, llx, lly, urx, ury, fillWhite
var n = doc.RedactMatches("email", 2, 0);                      // mode 2: a built-in pattern
n += doc.RedactMatches(@"\b\d{3}-\d{2}-\d{4}\b", 1, 0);         // mode 1: a regular expression

await view.ReloadAsync();
doc.Save(Path.Combine(FileSystem.AppDataDirectory, "redacted.pdf"));

RedactMatches(query, mode, fillWhite) takes plain text (mode 0), a regular expression (1) or a pattern id (2: email, phone, credit-card, iban, pt-nif, us-ssn, ipv4, url, date) and returns the number of areas redacted.

Redaction cannot be undone in the saved file. Keep the original if you may need it.

See the .NET redaction guide for more.