ssine / pptx2md

a pptx to markdown converter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cant save images that marked as an placeholder with an object instead of a picture, and the solution

alenwesker opened this issue · comments

As the title, I also turn the fix of the previous issue "cant save wmf" into a patch. I fixed it. Since I am busy working on something, pardon me for not making it a formal patch quest.

The key fix is in parser.py:

      elif shape.shape_type == MSO_SHAPE_TYPE.PICTURE:
        notes += process_picture(shape, idx + 1)
      elif shape.shape_type == MSO_SHAPE_TYPE.TABLE:
        notes += process_table(shape, idx + 1)
      else:  # Add the following lines
        if hasattr(shape, "placeholder_format"):
          ph = shape.placeholder_format
          if ph.type == PP_PLACEHOLDER.OBJECT and hasattr(shape, "image") and getattr(shape, "image"):
            notes += process_picture(shape, idx + 1)
          else:
            print(f"Unrecognized shape: {shape.shape_type}, place holder: {ph.type}, place at page: {idx + 1}")
        else:
          print(f"Unrecognized shape: {shape.shape_type}, place at page: {idx + 1}")

0001-Fix-some-image-used-as-object-that-can-t-be-output-a.patch

The ppt that can recreate the problem is also attached:

test.pptx

commented

Thanks for the solution, this fix is now published in version 1.6.0.