Last active
January 14, 2023 10:37
How to Decrypt PDF File using Python. For more details: https://kb.aspose.com/pdf/python/how-to-decrypt-pdf-file-using-python/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.pdf as pdf | |
#Set the source directory path | |
filePath = "C://Words//" | |
# Load the license in your application to decrypt the PDF | |
decryptPdfLicense = pdf.License() | |
decryptPdfLicense.set_license(filePath + "Conholdate.Total.Product.Family.lic") | |
# Load the source PDF document with password from the disk | |
decryptPdfDoc = pdf.Document(filePath + "Output.pdf","owner") | |
# Decrypt the PDF | |
decryptPdfDoc.decrypt() | |
# Save the decrypted PDF file on the disk | |
decryptPdfDoc.save(filePath + "GeneratedPdf.pdf") | |
print("PDF decryption done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment