Skip to content

Instantly share code, notes, and snippets.

View elip-OE's full-sized avatar

Eli Plaut elip-OE

View GitHub Profile
@elip-OE
elip-OE / decrypt_pdf.py
Last active January 7, 2021 13:40 — forked from bzamecnik/decrypt_pdf.py
Decrypt password-protected PDF in Python.
# Decrypt password-protected PDF in Python.
# cleaned-up version of http://stackoverflow.com/a/26537710/329263
#
# Requirements:
# pip install PyPDF2
#
# Usage: decrypt_pdf('encrypted.pdf', 'decrypted.pdf', 'secret_password')
from argparse import ArgumentParser
from PyPDF2 import PdfFileReader, PdfFileWriter