Skip to content

redact-pdf

Release Build status Commit activity License

Redact a phrase off a pdf file


Installation

pip install redact-pdf

Usage

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