De-identify PDF
Pass a PDF, get a de-identified PDF. The PDF needs extractable text — scanned image-only PDFs aren't supported (image de-id is coming soon).
- Python
- TypeScript
from custodian_labs import GuardianLayer
result = GuardianLayer().deidentify_file("report.pdf", masking_type="transform")
with open("deid_report.pdf", "wb") as f:
f.write(result.content)
import { writeFile } from "node:fs/promises";
import { GuardianLayer } from "@custodianlabs/sdk";
const result = await new GuardianLayer().deidentifyFile("report.pdf", { maskingType: "transform" });
await writeFile("deid_report.pdf", result.content);
Use redact when reviewers should see values were hidden.
Output unchanged?
Check the PDF has selectable text, it's really a .pdf, and pii_entities isn't too
narrow.