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 git@github.com:SUPAIDEAS/passifypdf.git
or
git clone https://github.com/SUPAIDEAS/passifypdf.git
pip install -r requirements.txt
Run the "main" from IDE or from CLI:
if __name__ == "__main__":
...
python encryptpdf.py
Sample Run:
change dir to "passifypdf/passifypdf",
Then run,
python encryptpdf.py
-------------------------Sample output----------------------
$python encryptpdf.py
Congratulations!
PDF file encrypted successfully and saved as 'Sample_PDF_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.