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 <dhlong2301@gmail.com>

* fix: Refactor missing bbox attribute to PdfTextCell

Signed-off-by: hl2311 <dhlong2301@gmail.com>

* Signed-off-by: hl2311 <dhlong2301@gmail.com>

fix: Refactor missing bbox attribute to PdfTextCell

---------

Signed-off-by: hl2311 <dhlong2301@gmail.com>
This commit is contained in:
Hoang-Long Do 2025-03-25 18:18:10 +07:00 committed by GitHub
parent f739d0e4c5
commit 6df8827231
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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()