Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

Update mineru/utils/draw_bbox.py

Xiaomeng Zhao0eec0d90b55c
diff --git a/mineru/utils/draw_bbox.py b/mineru/utils/draw_bbox.py
index 948148ab..a0b8f485 100644
--- a/mineru/utils/draw_bbox.py
+++ b/mineru/utils/draw_bbox.py
@@ -25,7 +25,11 @@ def cal_canvas_rect(page, bbox):
actual_height = page_height # The height of the final PDF display
rotation_obj = page.get("/Rotate", 0)
- rotation = int(rotation_obj) % 360 # cast rotation to int to handle IndirectObject
+ try:
+ rotation = int(rotation_obj) % 360 # cast rotation to int to handle IndirectObject
+ except (ValueError, TypeError) as e:
+ logger.warning(f"Invalid /Rotate value {rotation_obj!r} on page; defaulting to 0. Error: {e}")
+ rotation = 0
if rotation in [90, 270]:
# PDF is rotated 90 degrees or 270 degrees, and the width and height need to be swapped