If you have ever needed to black out an SSN, bank account, or client name on a PDF before sharing it—or scrub API keys and customer emails before pasting an error log into ChatGPT or Claude—you have probably run into two frustrating privacy traps:
- The "Cloud Redactor" Paradox: Almost every top Google result for "free PDF redactor" asks you to upload your unredacted NDA, invoice, or tax return to a remote server first.
-
The "Fake Redaction" Trap: Drawing black rectangles over a PDF in a basic viewer rarely deletes the underlying text layer. Anyone who hits
Ctrl+A→Ctrl+Ccan still copy the hidden secret right out from under the black box.
That pushed me to build ScrubLocal — a 100% client-side privacy suite that runs strictly inside browser memory (works offline in Airplane Mode, zero document uploads).
Here are the three engineering decisions that made it fast and actually irreversible.
1. True Pixel-Burn Redaction (Flattening Away the Text Layer)
Instead of appending a black <rect> annotation on top of existing PDF text streams, ScrubLocal renders each PDF page locally via pdfjs-dist onto an offscreen HTML5 <canvas>, physically overwrites the target pixels (solid blackout, coarse quantized pixelation, or frosted strip), and rebuilds a fresh, metadata-stripped PDF from those flattened bitmaps via pdf-lib:
// Flattened bitmap export guarantees zero selectable text layer survives
export async function exportBurnedPdfBlob(docObj) {
const { PDFDocument } = await import('pdf-lib');
const pdfDoc = await PDFDocument.create();
pdfDoc.setTitle('');
pdfDoc.setAuthor('');
pdfDoc.setProducer('');
for (const pageObj of docObj.pages) {
const burnedCanvas = renderBurnedPageCanvas(pageObj);
const jpgBytes = dataUrlToUint8Array(burnedCanvas.toDataURL('image/jpeg', 0.92));
const embedded = await pdfDoc.embedJpg(jpgBytes);
const page = pdfDoc.addPage([burnedCanvas.width * 0.5, burnedCanvas.height * 0.5]);
page.drawImage(embedded, { x: 0, y: 0, width: burnedCanvas.width * 0.5, height: burnedCanvas.height * 0.5 });
}
return new Blob([await pdfDoc.save()], { type: 'application/pdf' });
}
The deliberate trade-off: the exported PDF becomes image-based (no Ctrl+F search), which is exactly what you want when legal or security confidentiality matters more than text selectability.
2. Keeping Initial Page Load at ~30 KB With Dynamic Imports
Bundling pdfjs-dist, pdf-lib, and jszip eagerly bloated the first build to 987 KB of main JS—way too heavy for someone just visiting to sanitize a quick AI prompt.
By switching all three heavy libraries to lazy import() calls only when a user opens a PDF or clicks batch .zip export, the initial landing bundle dropped by 97% (987 KB → 30.5 KB raw / 11.8 KB gzip):
let pdfjsPromise = null;
function getPdfjs() {
if (!pdfjsPromise) {
pdfjsPromise = Promise.all([
import('pdfjs-dist'),
import('pdfjs-dist/build/pdf.worker.min.mjs?url'),
]).then(([lib, worker]) => {
lib.GlobalWorkerOptions.workerSrc = worker.default;
return lib;
});
}
return pdfjsPromise;
}
3. Reversible Local Token Vault for ChatGPT / Claude Prompts
When debugging production incidents or reviewing contracts with an LLM, scrubbing secrets manually is tedious—and putting real names back into the AI's reply is even worse.
ScrubLocal scans text locally in RAM for API keys (sk-, AKIA, ghp_, JWTs), emails, Luhn-valid payment cards, SSNs, IBANs, IPv4s, and custom company/person names, replacing every occurrence deterministically ([ENTITY_1], [EMAIL_1], [SECRET_1]) so the model preserves full context. Paste the AI's reply back, and one click restores the real values locally without ever sending the mapping table over the network.
Try It Live (Zero Signup, Built-In Samples)
You can test all three tools—including a binary EXIF / GPS / PDF Metadata Inspector & Stripper—directly at https://scrublocal.com using the built-in sample NDA, sample invoice, and simulated GPS-tagged photo (open DevTools → Network tab to verify 0 bytes of document data leave your machine).
Core single-file workflows are free forever with no login. For teams and heavy users, a one-time $14.99 Pro license (no subscription) unlocks multi-page PDF burn exports, unlimited prompt length + saved entity dictionaries, and batch metadata .ZIP downloads.
I'd love feedback from fellow developers: what other secret formats, document quirks, or workflow edge cases should I handle next?
Top comments (0)