Skip to main content

Secure a PDF

Redact literal text from a PDF

Find literal text matches, remove the matched PDF content, and verify extracted text, encoded strings, and decoded streams before download.

Practical steps

Remove and verify literal PDF text

Plan matches, confirm the destructive output change, apply redaction, and reject any failed verification.

  1. SearchChoose one PDF and enter the exact literal text that must be removed.
  2. ConfirmReview the destructive-action warning and require at least one match.
  3. VerifyApply the plan and download the PDF only after removal checks pass.

Redaction must remove content, not merely draw a black rectangle over visible text. The browser route plans case-insensitive literal matches, rewrites the document, and verifies concrete marker variants before offering the result.

Redact from .NET

using OfficeIMO.Pdf;

PdfDocument source = PdfDocument.Open("case-file.pdf");
var search = new PdfRedactionSearchOptions { MatchCase = false };
search.AddLiteral("Account 1234");

PdfRedactionPlan plan = source.Redactions.Search(search);
PdfDocument redacted = source.Redactions.Apply(plan);

var verify = new PdfRedactionVerificationOptions { MatchCase = false };
verify.RequireRemovedText("Account 1234");
PdfRedactionVerificationReport report = redacted.Redactions.Verify(verify);
report.ThrowIfFailed();

File.WriteAllBytes("case-file.redacted.pdf", redacted.ToBytes());

The verification report checks extracted text, raw PDF bytes, encoded strings, and decoded streams according to the selected markers. Keep the plan and report when the redaction decision must be auditable.

Important limits

Literal search depends on readable PDF text. It does not discover text embedded only in scanned images, infer sensitive entities, or replace human review of surrounding context. OCR-assisted and pattern-based policies should remain separate, explicit workflows.