Skip to main content

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).

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)

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.

See also​

File De-identification · Guardian Layer client