Skip to content

Commit 840d464

Browse files
committed
[Fix] Fixed missing page
1 parent e416ef9 commit 840d464

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def save_image(page, rect, i):
167167
return os.path.basename(image_path)
168168

169169
def write_text(
170+
page,
170171
textpage: fitz.TextPage,
171172
clip: fitz.Rect,
172173
tabs=None,
@@ -347,7 +348,7 @@ def output_tables(tabs, text_rect, tab_rects):
347348
del tab_rects[i]
348349
return this_md
349350

350-
def output_images(text_rect, img_rects):
351+
def output_images(page, text_rect, img_rects):
351352
"""Output and remove images and graphics above text rectangle."""
352353
this_md = "" # markdown string
353354
if text_rect is not None: # select tables above the text block
@@ -421,10 +422,11 @@ def get_page_output(doc, pno, textflags):
421422
for text_rect in text_rects:
422423
# outpt tables above this block of text
423424
md_string += output_tables(tabs, text_rect, tab_rects)
424-
md_string += output_images(text_rect, vg_clusters)
425+
md_string += output_images(page, text_rect, vg_clusters)
425426

426427
# output text inside this rectangle
427428
md_string += write_text(
429+
page,
428430
textpage,
429431
text_rect,
430432
tabs=tabs,

0 commit comments

Comments
 (0)