docling-project / docling-project/docling

Unexpected Read-Order Inversion & Column Merging

Open
#3,198 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug

In multi-column or heavily indented PDF layouts (Taiwanese Construction Specifications), Docling's `body` model occasionally outputs text out of order or merges disconnected text across columns into a single string.

Example Case:
```Plaintext
1.3.1 The contractor shall submit the latest external calibration records...
[Gap] construction measurement work may only proceed after approval.
```

The string `construction measurement work may only proceed after approval.` is sometimes appended or placed *after* the text that visually appears below/beside it, or the numbering `1.3.1` is detached from the rest of its sentence.

Looking at `DoclingDocument.texts`, items that should be independent row-elements are often grouped into the same `text` item even when separated by a significant horizontal gap (>40pt).

### Steps to reproduce

1. Initialize DocumentConverter and process a PDF with complex indentation or dual-column layouts.
2. Iterate through the DoclingDocument.texts list.

### Docling version
Docling version: 2.82.0
Docling Core version: 2.70.2
Docling IBM Models version: 3.12.0
Docling Parse version: 5.6.1
Python: cpython-312 (3.12.10)
Platform: Windows-10-10.0.19045-SP0

### Python version
Python 3.12.10

---

```json
{
"self_ref": "#/texts/7",
"parent": {
"$ref": "#/groups/1"
},
"children": [],
"content_layer": "body",
"label": "list_item",
"prov": [
{
"page_no": 1,
"bbox": {
"l": 90.024,
"t": 518.3859829101563,
"r": 324.62,
"b": 483.6819829101563,
"coord_origin": "BOTTOMLEFT"
},
"charspan": [
0,
22
]
}
],
"orig": "1.3.1 construction measurement work may only proceed after approval.",
"text": "1.3.1 construction measurement work may only proceed after approval.",
"enumerated": false,
"marker": ""
},

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.