mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2026-01-06 12:11:18 +00:00
Bug fix issue #89: trying to perform arithmetic on IndirectObject
TypeError: bad operand type for unary -: 'IndirectObject'
This commit is contained in:
parent
325cc0beca
commit
71b54035ba
@ -1043,7 +1043,12 @@ def add_text_layer(
|
||||
# Also, pdf_image may not have its mediabox nailed to (0, 0), so may need
|
||||
# translation
|
||||
page_image = pdf_image.getPage(0)
|
||||
rotation = page_image.get('/Rotate', 0)
|
||||
try:
|
||||
# pypdf DictionaryObject.get() does not resolve indirect objects but
|
||||
# __getitem__ does
|
||||
rotation = page_image['/Rotate']
|
||||
except KeyError:
|
||||
rotation = 0
|
||||
|
||||
# /Rotate is a clockwise rotation: 90 means page facing "east"
|
||||
# The negative of this value is the angle that eliminates that rotation
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user