From 83ff6fea00de5ab0b82704c4e8aa4258c9e504d6 Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Wed, 16 Nov 2016 09:04:17 -0500 Subject: [PATCH] Additional error output for failed encryption --- PyPDF2/pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index d1751a7..58f4ca6 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -2057,7 +2057,7 @@ class PdfFileReader(object): if encrypt['/Filter'] != '/Standard': raise NotImplementedError("only Standard PDF encryption handler is available") if not (encrypt['/V'] in (1, 2)): - raise NotImplementedError("only algorithm code 1 and 2 are supported") + raise NotImplementedError("only algorithm code 1 and 2 are supported. This PDF uses code %s" % encrypt['/V']) user_password, key = self._authenticateUserPassword(password) if user_password: self._decryption_key = key