Skip to content

Commit 9c2b9b8

Browse files
committed
[Fix] Fixed missing empty img
1 parent 840d464 commit 9c2b9b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ def output_tables(tabs, text_rect, tab_rects):
350350

351351
def output_images(page, text_rect, img_rects):
352352
"""Output and remove images and graphics above text rectangle."""
353+
if img_rects is None:
354+
return ""
353355
this_md = "" # markdown string
354356
if text_rect is not None: # select tables above the text block
355357
for i, img_rect in sorted(
@@ -438,7 +440,7 @@ def get_page_output(doc, pno, textflags):
438440

439441
# write remaining tables.
440442
md_string += output_tables(tabs, None, tab_rects)
441-
md_string += output_images(None, tab_rects)
443+
md_string += output_images(None, tab_rects, None)
442444
md_string += "\n-----\n\n"
443445
return md_string
444446

0 commit comments

Comments
 (0)