问题
Hi I'm looking for a python lib that will allow me to set password protected print, copy, paste options on some existing pdfs
I looked at the reportlab pdfencrypt module: this has exactly the options I need, but the open source version is heavily restricted - cant even set a real password, and the license is not an option (over £1000/year) - this will be relatively low volume (< 1000 docs processed per year), and the client is a non-profit organisation
any suggestions greatly appreciated!
回答1:
Have you tried The PDF Toolkit, command-line interface (pdftk
)?
http://www.pdflabs.com/docs/pdftk-cli-examples/
回答2:
Laaate answer, but I wanted to start contributing...
in the pdf.py file, in the encypt() method, change the flag:
# permit everything:
P = -1
to:
# prevent everything:
P = -3904
This will prevent all features beyond simple viewing. Be sure to pass in a different owner password.
回答3:
PyPDF allows encrypting PDF files.
来源:https://stackoverflow.com/questions/13109867/python-pdf-set-password-protected-print-copy-paste-options