Use passifypdf to protect your PDF files with a password of your choice. Same as encrypt or lock your PDF via a password.
git clone https://github.com/SUPAIDEAS/passifypdf.gitUses Poetry for dependency management.
cd passifypdf
pip install poetry
poetry installRun the CLI tool using poetry run:
poetry run passifypdf --helpOr activate the shell:
poetry shell
passifypdf --helpSample Run:
passifypdf -i input.pdf -o protected.pdf -p mySecretPassword
# -------------------------Sample output----------------------
# Congratulations!
# PDF file encrypted successfully and saved as 'protected.pdf'If you have nay special chars(example: an emoji like Star 🌟) in the PDF file, it gives a minor complain during execution. But it still does the job, so you can ingore that "char or object error" which you see in the output.
In general you can use passifypdf to protect your PDF files against chance attackers. But you should not rely on this for mission-critical data or situation.
Visit BUILD.md