python: pdf - set password protected print, copy, paste options?

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!


Have you tried The PDF Toolkit, command-line interface (pdftk)?

PyPDF allows encrypting PDF files.

Laaate answer, but I wanted to start contributing...

in the file, in the encypt() method, change the flag:

    # permit everything:
    P = -1


    # prevent everything:
    P = -3904

This will prevent all features beyond simple viewing. Be sure to pass in a different owner password.

Need Your Help