Python PyPDF2 — Encrypt a PDF file


Python script that will encrypt a PDF file. To do this we use PyPDF2 which is a Python library that enables users to perform various operations on PDF documents.

In this example the password for the encrypted file will be set to ‘iamlegend’, if you do use this code as part of your own project be sure to change this something appropriate.

Also be sure to subscribe to our YouTube channel for daily coding content.




Programming - Projects - Source Code available for everything -


See more recommendations