Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.01 KB

File metadata and controls

55 lines (37 loc) · 1.01 KB

Ghost

logo

Ghost writes a copy of a PDF with metadata values removed.

The default output path is the original filename with _SANITIZED appended before the .pdf extension.

Metadata fields

Ghost removes values for the following common metadata fields:

  • /Author
  • /Producer
  • /Title
  • /Subject
  • /Creator
  • /Keywords
  • /CreationDate
  • /ModDate
  • /Trapped
  • /PTEX.Fullbanner

Any other metadata keys found in the PDF are also blanked in the sanitized copy.

Requirements

This project was written for Python 3.12 and uses PyPDF2.

Install dependencies with:

python3 -m pip install -r requirements.txt

Usage

python3 ghost.py path/to/file.pdf

Choose an explicit output path:

python3 ghost.py path/to/file.pdf --output path/to/clean.pdf

Print metadata before sanitizing:

python3 ghost.py path/to/file.pdf --verbose

Ghost will not overwrite an existing output file unless --overwrite is supplied.