diff --git a/HISTORY.rst b/HISTORY.rst index 3a19cdf385..0e927ad899 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,3 +1,8 @@ +2.6.5 (2017-XX-XX) +================== +- Add workaround for PDF with IndirectObject as the + rotation value. GitHub #261. + 2.6.4 (2017-07-26) ================== - Add missing replacements of reverse to resolve_url. diff --git a/mayan/apps/converter/backends/python.py b/mayan/apps/converter/backends/python.py index b97d4b6d0c..e17de77906 100644 --- a/mayan/apps/converter/backends/python.py +++ b/mayan/apps/converter/backends/python.py @@ -92,7 +92,9 @@ class Python(ConverterBase): if self.mime_type == 'application/pdf': pdf = PyPDF2.PdfFileReader(self.file_object) try: - result = pdf.getPage(page_number - 1).get('/Rotate') + result = pdf.getPage(page_number - 1).get('/Rotate', 0) + if isinstance(result, PyPDF2.generic.IndirectObject): + result = result.getObject() except Exception as exception: self.file_object.seek(0) pdf = PyPDF2.PdfFileReader(self.file_object)