-def resolve_objects_names(pdf, objects_ids):
- logger.debug("objects_ids %s", objects_ids)
- objects_names = []
- for objnum in objects_ids:
- indirect_object = pdf.findindirect(objnum, 0)
- if isinstance(indirect_object, PdfIndirect):
- try:
- real_object = indirect_object.real_value()
- if real_object.Name:
- objects_names.append(real_object.Name)
- else:
- logger.warning("Object %d has an empty 'Name' attribute", objnum)
- except AttributeError:
- logger.warning("Object %d has no 'Name' attribute", objnum)
- else:
- logger.warning("Object %d is not a PdfIndirect but a %s",
- objnum, type(indirect_object))
-
- logger.debug("objects_names %s\n", objects_names)
- return objects_names
-
-
-def strip_objects(pdf, objects_names):