Add workaround for PDF with IndirectObject as the

rotation value. GitHub #261.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-07-30 04:17:23 -04:00
parent 6a8868e632
commit 28b4c9a546
2 changed files with 8 additions and 1 deletions

View File

@@ -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.

View File

@@ -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)