From 6df882723112f9ddc22a5ace4048e1d5acb30737 Mon Sep 17 00:00:00 2001 From: Hoang-Long Do <89198139+hl2311@users.noreply.github.com> Date: Tue, 25 Mar 2025 18:18:10 +0700 Subject: [PATCH] fix(debug): Missing translation of bbox to to_bounding_box (#1220) * Fix: Add missing bbox attribute to PdfTextCell * Fix: Add missing bbox attribute to PdfTextCell Signed-off-by: hl2311 * fix: Refactor missing bbox attribute to PdfTextCell Signed-off-by: hl2311 * Signed-off-by: hl2311 fix: Refactor missing bbox attribute to PdfTextCell --------- Signed-off-by: hl2311 --- docling/models/page_preprocessing_model.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docling/models/page_preprocessing_model.py b/docling/models/page_preprocessing_model.py index 9dc291a..d1b29e3 100644 --- a/docling/models/page_preprocessing_model.py +++ b/docling/models/page_preprocessing_model.py @@ -63,7 +63,13 @@ class PagePreprocessingModel(BasePageModel): def draw_text_boxes(image, cells, show: bool = False): draw = ImageDraw.Draw(image) for c in cells: - x0, y0, x1, y1 = c.bbox.as_tuple() + x0, y0, x1, y1 = ( + c.to_bounding_box().l, + c.to_bounding_box().t, + c.to_bounding_box().r, + c.to_bounding_box().b, + ) + draw.rectangle([(x0, y0), (x1, y1)], outline="red") if show: image.show()