From e9d0b86cc541413dc8516dbd5675b14c1453d0c1 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 27 Sep 2016 12:55:53 -0400 Subject: [PATCH 1/6] README.md: fix sample code directory name --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23a1eef..a59bb5c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ http://mstamy2.github.io/PyPDF2/ ##Examples -Please see `sample code` folder +Please see the `Sample_Code` folder. ##Documentation @@ -31,4 +31,4 @@ Tests can be run from the command line by: ```bash python -m unittest Tests.tests -``` \ No newline at end of file +``` From 8ba44f2099f8971cd8885c8bc3786ca2455157f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=81uszczyk?= Date: Fri, 21 Oct 2016 21:35:39 +0200 Subject: [PATCH 2/6] Fix PdfFileMerger for file objects on Python 3. The previous check was always evaluated to False on Python 3, so I replaced it with a duck-typing one compatible with both Python versions. --- PyPDF2/merger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyPDF2/merger.py b/PyPDF2/merger.py index 27702ad..c3373e4 100644 --- a/PyPDF2/merger.py +++ b/PyPDF2/merger.py @@ -113,7 +113,7 @@ class PdfFileMerger(object): if isString(fileobj): fileobj = file(fileobj, 'rb') my_file = True - elif isinstance(fileobj, file): + elif hasattr(fileobj, "seek") and hasattr(fileobj, "read"): fileobj.seek(0) filecontent = fileobj.read() fileobj = StreamIO(filecontent) From 83ff6fea00de5ab0b82704c4e8aa4258c9e504d6 Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Wed, 16 Nov 2016 09:04:17 -0500 Subject: [PATCH 3/6] 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 From 62c1016961bac18f25da8885a03de5feb54f561b Mon Sep 17 00:00:00 2001 From: Subhrajyoti Sen Date: Sat, 25 Mar 2017 11:25:06 +0530 Subject: [PATCH 4/6] Update README to new markdown specs --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a59bb5c..233201b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#PyPDF2 +# PyPDF2 PyPDF2 is a pure-python PDF library capable of splitting, merging together, cropping, and transforming @@ -10,22 +10,22 @@ as merge entire files together. Homepage http://mstamy2.github.io/PyPDF2/ -##Examples +## Examples Please see the `Sample_Code` folder. -##Documentation +## Documentation Documentation is available at https://pythonhosted.org/PyPDF2/ -##FAQ +## FAQ Please see http://mstamy2.github.io/PyPDF2/FAQ.html -##Tests +## Tests PyPDF2 includes a test suite built on the unittest framework. All tests are located in the "Tests" folder. Tests can be run from the command line by: From c3231c7ded644f9afe891a9a1e58aa09b60bbf97 Mon Sep 17 00:00:00 2001 From: Kyle Gengler Date: Tue, 28 Mar 2017 06:58:36 -0500 Subject: [PATCH 5/6] update _rotate function to account for /Rotate being set to an IndirectObject instead of an int --- PyPDF2/pdf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index 58f4ca6..c4a25d6 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -2226,7 +2226,8 @@ class PageObject(DictionaryObject): return self def _rotate(self, angle): - currentAngle = self.get("/Rotate", 0) + rotateObj = self.get("/Rotate", 0) + currentAngle = rotateObj if isinstance(rotateObj, int) else rotateObj.getObject() self[NameObject("/Rotate")] = NumberObject(currentAngle + angle) def _mergeResources(res1, res2, resource): From 7844852204c08694c2a172fa6f65615d2c06e7c5 Mon Sep 17 00:00:00 2001 From: Caio Moreira Gomes Date: Sun, 7 May 2017 17:24:57 -0300 Subject: [PATCH 6/6] Addition of line break for PDF line separators, i've been useing it and my files where only one line. --- PyPDF2/pdf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PyPDF2/pdf.py b/PyPDF2/pdf.py index 58f4ca6..cda9f3f 100644 --- a/PyPDF2/pdf.py +++ b/PyPDF2/pdf.py @@ -2665,6 +2665,7 @@ class PageObject(DictionaryObject): _text = operands[0] if isinstance(_text, TextStringObject): text += _text + text += "\n" elif operator == b_("T*"): text += "\n" elif operator == b_("'"):