Backup commit before executing remove-unused-code proposal. This includes all pending changes and new features. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.1 KiB
1.1 KiB
Change: Fix OCR Track Table Rendering and Text Sizing
Why
OCR Track 處理產生的 PDF 有兩個主要問題:
- 表格內容消失:PP-StructureV3 正確返回了
table_res_list(包含pred_html和cell_box_list),但pp_structure_enhanced.py在通過 bbox overlap 匹配時只提取了cell_boxes而沒有提取pred_html,導致表格的 HTML 內容為空。 - 文字大小不一致:OCR 座標系 (1275x1650 pixels) 與 PDF 輸出尺寸 (612x792 pts) 之間的縮放因子 (0.48) 導致字體大小計算不準確,文字過小或大小不一致。
What Changes
- 修復
pp_structure_enhanced.py中 bbox overlap 匹配時的 HTML 提取邏輯 - 改進
pdf_generator_service.py中 OCR Track 的座標系處理,使用 OCR 座標系尺寸作為 PDF 輸出尺寸 - 調整
_check_cell_boxes_quality()函數的判定邏輯,避免過度過濾有效表格
Impact
- Affected specs:
ocr-processing - Affected code:
backend/app/services/pp_structure_enhanced.py- 表格 HTML 提取邏輯backend/app/services/pdf_generator_service.py- PDF 生成座標系處理