pdfinfo: skip null FormX entries

This commit is contained in:
James R. Barlow
2023-01-01 16:58:14 -08:00
parent f0cc7f2230
commit 90b2119ad3
+3 -5
View File
@@ -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(