Python 3 Script to Encrypt and Decrypt PDF Documents With Password Using PyPDF2 Library Full Project For Beginners

You are currently viewing Python 3 Script to Encrypt and Decrypt PDF Documents With Password Using PyPDF2 Library Full Project For Beginners

 

 

 

Welcome folks today in this post we will be encrypting and decrypting  pdf documents with password in python 3 using pypdf2 library. All the source code of the project is given below.

 

 

Get Started

 

 

In order to get started you need to install pypdf2 library using pip command as follows

 

pip install pypdf2

 

 

After installing it you need to create a app.py file and copy paste the following code

 

 

app.py

 

 

 

 

 

Now in this python script you will see we are taking the input pdf file and we are encrypting it with a password and a output file is created.

 

 

 

 

 

As you can see if you open the pdf file then you need to enter the password which you configured at time of encryption

 

 

Decryption of PDF

 

 

Now comes the decryption part. When we want to decrypt the pdf using the password we know.

 

 

 

 

 

Now you will see a decrypted_pdf file will be created in the root directory

 

 

 

 

Leave a Reply