What is PDF Masker?
PDF Masker is a small Python toolkit for black-box-redacting the same fields across a batch of PDFs that share one layout — think payroll slips, HR forms, or any recurring document where you need to blank out addresses, ID numbers, or dates of birth for dozens or hundreds of people at once.
Instead of opening each file and manually drawing boxes, you calibrate the mask coordinates once on a sample page, then apply that same mask set to every PDF in the input folder in one run.
Who is this for?
- HR or payroll staff who need to redact personal fields from a batch of forms before archiving or sharing them
- Anyone handling recurring documents with a fixed layout who wants to avoid manual, error-prone redaction
- Teams that can't send sensitive PDFs to a cloud redaction service and need something that runs entirely offline
How it works
Most "redaction" tools just draw a black rectangle on top of the existing PDF — the text underneath is still there and can be recovered by selecting and copying it. PDF Masker avoids this by rasterizing each page into an image first, drawing the black boxes onto that image, and rebuilding the PDF from the flattened image. Once a page has been processed, there is no text layer left to extract.
Setting up the mask coordinates is done visually: mask_picker.py opens a small GUI where you drag rectangles over the fields to redact and type a label for each one (a field name like "address", never the actual value). The result is saved to mask_coords.json, which holds only coordinates and field names — never personal data — so it's safe to share when asking for help adjusting a mask layout. For environments where the GUI isn't available, calibrate.py overlays a coordinate grid on the page image so the same rectangles can be read off and entered by hand.
Privacy by design
This directly reflects how we build tools here: your data stays on your machine, always. The entire workflow — viewing pages, picking coordinates, generating the redacted output — runs locally with no network calls. Nothing about the documents themselves, only field labels and pixel coordinates, ever needs to be shared or shown to anyone outside the process.
Technical specs
- Input / output: PDF → PDF (redacted pages are flattened images embedded in a new PDF)
- Stack: Python, PyMuPDF (
fitz) for PDF rendering, Pillow for drawing masks, Tkinter for the mask picker GUI - Batch model: one mask set (
MASKS) applied to every PDF ininput/; documents with a different layout need their own mask set - Coordinate system: PDF points (pt), matched against the page's rasterization zoom factor before drawing