How to anonymise sensitive data in PDF documents with Python

TL;DR AI
2 min readKey summary
A Python tool anonymizes bank statements by editing PDF content streams directly, replacing sensitive fields with fake values while preserving layout and font encoding.
It supports multiple encoding types plus configurable always-anonymize and never-anonymize rules for flexible redaction.
The tool can consistently map the same account details to the same fake output across statements, which helps when comparing or processing related documents.
This makes it safer to share bank statements for debugging or automation without exposing personal or financial data.
