Skip to content

Commit

Permalink
pdfinfo: skip null FormX entries
Browse files Browse the repository at this point in the history
  • Loading branch information
jbarlow83 committed Jan 2, 2023
1 parent f0cc7f2 commit 90b2119
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ocrmypdf/pdfinfo/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,12 @@ def _image_xobjects(container) -> Iterator[tuple[Object, str]]:
resources = container['/Resources']
if '/XObject' not in resources:
return
xobjs = resources['/XObject'].as_dict()
for xobj in xobjs:
candidate: Object = xobjs[xobj]
if '/Subtype' not in candidate:
for key, candidate in resources['/XObject'].items():
if candidate is None or '/Subtype' not in candidate:
continue
if candidate['/Subtype'] == '/Image':
pdfimage = candidate
yield (pdfimage, xobj)
yield (pdfimage, key)


def _find_regular_images(
Expand Down

0 comments on commit 90b2119

Please sign in to comment.