PDF file protection using password in Python

Published: 01 January 1970
on channel: Python Coding (CLCODING)
407
11

Code : #pip install PyPDF2
from PyPDF2 import PdfFileWriter, PdfFileReader
import getpass
pdfwriter=PdfFileWriter()
pdf=PdfFileReader('C:\\Users\\Irawen\\Documents\\embedded\\Python\\clcoding.pdf')
for page_num in range(pdf.numPages):
pdfwriter.addPage(pdf.getPage(page_num))
password=getpass.getpass(prompt='Enter Password: ')
pdfwriter.encrypt(password)
with open('C:\\Users\\Irawen\\Documents\\embedded\\Python\\clcoding.pdf','wb') as f:
pdfwriter.write(f)

print("Now File is password protected")

We are supporting freely to everyone. Join us for live support.

WhatApp Support: wa.me/917385021801

Free program: https://www.clcoding.com/

Free Codes: https://clcoding.quora.com/

Free Support: pythonclcoding@gmail.com

Live Support: https://t.me/jupyter_python

Like us:   / pythonclcoding  

Join us:   / pythonclcoding  

Python Book for the beginner: https://amzn.to/2Z8e0OA


On this page of the site you can watch the video online PDF file protection using password in Python with a duration of hours minute second in good quality, which was uploaded by the user Python Coding (CLCODING) 01 January 1970, share the link with friends and acquaintances, this video has already been watched 407 times on youtube and it was liked by 11 viewers. Enjoy your viewing!