Skip empty pages and keep going, this fixes processing some PDF files
that have placeholder pages.
for i, page in enumerate(pdf.pages):
logger.debug("Page %d", i + 1)
for i, page in enumerate(pdf.pages):
logger.debug("Page %d", i + 1)
+ # skip empty pages
+ if not page.Resources.XObject:
+ continue
+
# Map all the objects in the page using the objects id as the key and
# the resource name as the value.
name_map = {indirect_obj.indirect[0]: name for name, indirect_obj in page.Resources.XObject.items()}
# Map all the objects in the page using the objects id as the key and
# the resource name as the value.
name_map = {indirect_obj.indirect[0]: name for name, indirect_obj in page.Resources.XObject.items()}