Redact a phrase off a pdf file
- Github repository: https://github.com/levyvix/redact-pdf/
- Documentation https://levyvix.github.io/redact-pdf/
pip install redact-pdfUse the project in a python file
from redact_pdf.redact import TextRedactor
from pathlib import Path
pdf_file = Path(__file__).parent / "pdf_test.pdf"
save_path = Path(__file__).parent / "pdf_test_redacted.pdf"
tr = TextRedactor()
tr.redact_text(
file_path=pdf_file,
text_to_redact="XXX",
output_file_name=save_path,
)This will result in a .pdf file called pdf_test_redacted.pdf with the phrase XXX removed from every page.