Detect
PiiExtraction finds names, IDs, cards, and more across every page, each with a type and confidence score.
Smart redaction pairs an on-device model that finds sensitive data
with an engine that truly removes it. A local model detects PII
across every page, a human keeps or drops each suggestion, and
PdfRedactor erases the approved values from the file.
It runs on one contract or a nightly batch of thousands, the output
carries no recoverable trace, and nothing ever leaves your machine.
PiiExtraction finds names, IDs, cards, and more across every page, each with a type and confidence score.
A person keeps or drops each suggestion. The final decision, and the accountability, stays with a human.
PdfRedactor deletes the underlying content. Not a black box over it: unrecoverable by extraction or inspection.
Four stages, each backed by a real API. Detection never redacts on its own: a human gates the removal, and the result is verified.
1 · Identify
A local model reads the document and returns every PII item with a type, a confidence score, and its bounding box on the page. Those boxes (the entity's occurrences) are exactly what the redactor marks, so removal is precise.
2 · Review
A reviewer keeps or drops each suggestion, in bulk or one at a time. Confidence scores make triage fast: auto-approve the obvious, prompt only for the uncertain.
3 · Remove
Approved occurrences become redaction marks. Text glyphs, image pixels, vector graphics, and annotations under each mark are deleted and the pages regenerated. No hidden layer survives.
4 · Verify
A fresh search over the output confirms every removed value is unrecoverable, and the redaction report records exactly what was deleted for your audit trail.
A standard set of PII categories out of the box, plus custom categories you define for your own documents.
Person names, dates of birth, postal addresses, email addresses, phone numbers.
Credit card numbers, bank account numbers, and other payment identifiers.
Social Security numbers and national identifiers, with a catch-all discovery mode for the rest.
IP addresses and URLs that can deanonymize a record or a session.
Add your own labels, for example internal case numbers or SWIFT codes, with a single PiiEntityDefinition.
Attach an OCR engine and PII is recovered from scans and photos before detection, so image-only PDFs are covered too.
A local model returns every PII item with its type, confidence, and page positions. Text modality keeps glyph positions for precise redaction.
using LMKit.Data; using LMKit.Inference; using LMKit.Model; using LMKit.TextAnalysis; LM model = LM.LoadFromModelID("qwen3.5:4b"); var extractor = new PiiExtraction(model) { PreferredInferenceModality = InferenceModality.Text, // keep glyph positions }; using var document = new Attachment("account_application.pdf"); var entities = extractor.Extract(document); foreach (var e in entities) Console.WriteLine($"{e.EntityDefinition.Label}: \"{e.Value}\" ({e.Confidence:0.00})");
Keep the decision with a person. Auto-approve the high-confidence items and queue the rest for a human reviewer.
// Human-in-the-loop policy: auto-approve the obvious, review the uncertain. var approved = new List<PiiExtraction.PiiExtractedEntity>(); var needsReview = new List<PiiExtraction.PiiExtractedEntity>(); foreach (var e in entities) { if (e.Confidence >= 0.85f) approved.Add(e); else needsReview.Add(e); // show these to a reviewer before deciding }
Detected occurrences feed PdfRedactionArea.FromRegion for precise marks, with the value as a safety net. Then verify nothing survived.
using LMKit.Document.Pdf; var request = new PdfRedactionRequest(); foreach (var e in approved) { foreach (var occurrence in e.Occurrences) request.Areas.AddRange(PdfRedactionArea.FromRegion(occurrence)); request.SearchTerms.Add(e.Value); // safety net for anything not placed } PdfRedactionResult result = PdfRedactor.RedactToBytes( File.ReadAllBytes("account_application.pdf"), request); File.WriteAllBytes("account_application_redacted.pdf", result.Data); // Verify: the removed values can no longer be found. using var redacted = new Attachment(result.Data, "redacted.pdf"); foreach (var value in approved.Select(e => e.Value).Distinct()) Console.WriteLine($"{value}: {PdfSearch.FindText(redacted, value).TotalMatches} match(es)");
The workflow is designed to run at volume. The same detect, review, and remove code drives an interactive tool or an unattended pipeline, so a mailroom backlog and a single contract use the same path.
Batch
Point the pipeline at a folder, a bucket, or a message queue. Each PDF or image runs the full identify, redact, and verify flow, and writes a redacted copy plus an audit record.
Policy
Apply a confidence policy: auto-approve high-confidence items and route only the uncertain to a reviewer. Volume scales up without giving up human accountability.
Parallel
Process documents concurrently across CPU cores and GPUs. Detection and redaction are local, so throughput scales with your hardware, not an API quota.
Headless
Embed the library in a background service, a console job, or a container with no UI, wherever your .NET workloads already run. No external service to call and no per-document quota.
Redaction is a compliance control, so the design leaves no gaps: the data never leaves your infrastructure and the removal is real.
On-device
Detection and redaction run locally, with no SaaS dependency. That supports GDPR, HIPAA, and data-residency requirements by keeping documents inside your boundary.
Unrecoverable
Content is removed from the content streams, image data, and annotation objects, then the pages are regenerated. Nothing survives in a hidden layer or the raw bytes.
Accountable
The review stage keeps the final call with a person, which reduces the risk from a model false negative and gives you a clear line of responsibility.
Auditable
The redaction report records exactly what was removed, and the verification pass proves the values are gone. Both are easy to log for an audit trail.
Encrypted
Open password-protected PDFs by supplying the password. The redacted output is always written unencrypted and clean.
Precise
Redaction works at glyph granularity, so text outside a mark keeps its exact position. Only what you approve is removed.
Redact PII from KYC files and statements before a GDPR review or a data-subject request.
Strip identifiers from claims documents before they go to a regulator or a third party.
Remove patient identifiers from records before sharing, in line with HIPAA.
Prepare sensitive files for disclosure, discovery, and public-records responses.
Neutralize documents before using them to train or fine-tune models, so PII never enters the dataset.
PdfRedactor is the removal engine underneath: mark by search term, area, or /Redact annotation and delete the content permanently.
The same on-device models pull invoices, contracts, and forms into typed fields, with the same privacy guarantees.
Give the detector a text layer for scans and photos with the on-device OCR engines, so image-only PDFs are covered too.
Archive the redacted result as ISO 19005 PDF/A: fonts embedded, colours calibrated, metadata rebuilt.
Working console demos on GitHub, step-by-step how-to guides on the docs site, and the API reference for the classes used on this page.
Detect PII, review it with a human in the loop, then permanently remove it from a PDF.
Open on GitHub → SampleStep-by-step doc page: pipeline, prerequisites, code path, expected output.
Read on docs → How-to guideIdentify, review, remove, verify: the four-stage workflow with security notes.
Read the guide → API referenceAPI reference for on-device PII detection.
Open the reference →