PII redaction for e-filed legal documents (India).
Every plaint, brief, and agreement a lawyer e-files carries personal data — phone numbers, emails, bank accounts, Aadhaar, PAN, client names — and courts increasingly require it masked before filing. Blacking out by hand in a PDF editor leaves the text recoverable underneath. This tool physically removes the data from the PDF file itself.
| Type | Example |
|---|---|
| Aadhaar (grouped or plain) | 2345 6789 0123 |
| PAN | ABCDE1234F |
| Mobile (with/without +91) | +91-9876543210 |
priya.nair@example.net |
|
| Bank account / long digit runs (9–18 digits) | 5478123900123456 |
Party names & parentage (S/o, W/o, D/o …) |
Sh. Suresh Sharma |
| Full addresses — party blocks & text body | R/o 456, Laxmi Nagar, New Delhi - 110092residing at C-15, Green Park Colony, New Delhi - 110016 |
| Address markers + PIN (H.No, Flat No, Village, District, Post …) | Flat No. 12, Sector 45, Noida - 201301 |
Safe by design: role words (Plaintiff, Defendant, Petitioner, Counsel,
Judge, Court) are never redacted, even when an address ends on the same
line as ... Plaintiff. Court titles (DISTRICT JUDGE) are untouched.
cd ~/Documents/filing-redactor
python3 -m pip install pymupdf1. Scan a PDF — see what PII is in it (no changes):
python3 filing_redactor.py scan plaint.pdf2. Add party/client names (optional, text file, one name per line):
echo "Ramesh Kumar Sharma" >> names.txt
echo "Priya Nair" >> names.txt3. Redact — produce a clean file (original untouched):
python3 filing_redactor.py redact plaint.pdf -o plaint_redacted.pdf --names names.txtAdd --strip-metadata to also wipe the author/title hidden fields.
sample_plaint.pdf— a fake plaint with 10 PII itemsredacted_plaint.pdf— after redaction,pdftotextshows 0 of the original PII remain. Redaction boxes are rendered (not just drawn), so the data under them is gone from the file.visual_before.png/visual_after.png— side-by-side view
- Works on text-layer PDFs (Word/Google Docs/Scanned-with-OCR output).
Pure image scans need OCR first (e.g. the free
ocrmypdf). - The original file is never modified — you always get a new output file.
scannever writes;redactnever overwrites in place.