Currently I am using the PyPDF 2 as a dependency.
I have encountered some encrypted files and handled
them as you normally would (in the following code):
PDF = PdfFileReader(file(pdf_filepath, 'rb'))
if PDF.isEncrypted:
PDF.decrypt("")
print PDF.getNumPages()
My filepath looks something like "~/blah/FDJKL492019 21490 ,LFS.pdf"
PDF.decrypt("") returns 1, which means it was successful. But when it hits print PDF.getNumPages(),
it still raises the error, "PyPDF2.utils.PdfReadError: File has not been decrypted".
How do I get rid of this error?
I can open the PDF file just fine by double click (which default-opens with Adobe Reader).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…