docling-project / docling-project/docling

page_range in DocumentConverter.convert() can cause text out of order

Open
#1,758 1 comment 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
When processing a PDF with `DocumentConverter.convert()` using a `page_range=(start, end)`
For example,
conv_res = doc_converter.convert(source='2206.01062.pdf', page_range=(7, 9))
text from page 9 appeared in the Markdown generated for page 7.

This issue does *not* occur when processing one page at a time by using `page_range=(7, 7)`
...

### Steps to reproduce
Use the following Python script process the PDF
```python
pipeline_options = PdfPipelineOptions()
pipeline_options.images_scale = IMAGE_RESOLUTION_SCALE
pipeline_options.generate_page_images = True
pipeline_options.generate_picture_images = True

doc_converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
}
)
conv_res = doc_converter.convert(source='2206.01062.pdf', page_range=(7, 9))
conv_res.document.save_as_markdown('2206.md', image_mode=ImageRefMode.EMBEDDED)
```
...

### Docling version
Docling version: 2.36.1
Docling Core version: 2.36.0
Docling IBM Models version: 3.4.4
Docling Parse version: 4.0.4
Python: cpython-310 (3.10.12)
Platform: Linux-6.6.56+-x86_64-with-glibc2.35
...

### Python version
Python 3.10.12
...

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.