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.
Redaction summary
- Input
- PDF and literal text
- Output
- Verified redacted PDF
- Package
- OfficeIMO.Pdf
- Runs on
- Browser-local WebAssembly or .NET
- Microsoft Office
- Not required
- License
- MIT
The browser route performs case-insensitive literal matching; image-only text requires an OCR-aware policy.
Browse all PDF workflowsPractical steps
Remove and verify literal PDF text
Plan matches, confirm the destructive output change, apply redaction, and reject any failed verification.
- SearchChoose one PDF and enter the exact literal text that must be removed.
- ConfirmReview the destructive-action warning and require at least one match.
- 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.Load("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.