改进阿拉伯文/RTL PDF 文本提取:不保留逻辑阅读顺序和表格列的关联
Improve Arabic/RTL PDF text extraction: logical reading order and table column associations are not preserved
Description
MarkItDown's PDF converter does not reliably preserve the logical reading order of Arabic and other right-to-left (RTL) text.
In some PDFs, Arabic characters, words, lines, and table columns are extracted according to their visual placement in the PDF rather than their Unicode logical reading order. This can produce reversed text and, more importantly, incorrect relationships between table headers and values.
I observed this behavior with MarkItDown 0.1.3 and reproduced the reversed Arabic output with 0.1.7.
Example
Expected Arabic text:
تاريخ المزاد
مزاد ربى نجد
قطعة رقم 604 شمالاً
شركة أركان الكيان العقاريةExtracted output:
دازملا خيرات
داﺰـﻣ
ﺪﺠﻧ ﻰﺑر
604 مقر ةعطق لاً امش
ةيراقعلا نايكلا ناكرأ ةكرشThis appears to involve more than simple line ordering. Some text also contains Arabic Presentation Forms, and mixed Arabic/numeric sequences are reconstructed incorrectly.
Table extraction issue
The problem becomes more significant when extracting structured information from RTL tables.
For example, the source PDF may contain property boundaries equivalent to:
Direction | Boundary -- | -- North | Plot 604 South | Plot 602 East | Plot 597 West | 30-meter street内容来源: microsoft/markitdown