docling-project / docling-project/docling

page_break_placeholder option doesn't detect two or more page breaks in a row

Open
#2,623 2 comments 0 reactions 0 assignees View on GitHub
bug triage/close-stale
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
3d 4h
Merged PRs (30d)
98

Description

### Bug
When the source pdf has empty pages, it's expected that Docling produces a markdown with the amount of page break expressions strictly less by one than the total number of pages. But the actual number of page break expressions is less than expected by the number of empty pages (i.e., with a 100-page source pdf having 2 empty pages, I expect to see 99 page break expressions in the markdown, but the actual number of them is only 97).
...

### Steps to reproduce
My code:
```
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.backend.docling_parse_v2_backend import DoclingParseV2DocumentBackend
from docling.datamodel.base_models import InputFormat

def run(input_file, output_file, converter):
result = converter.convert(input_file)
my_md = result.document.export_to_markdown(page_break_placeholder='')
with open(output_file, 'w') as outFile:
outFile.write(my_md)

conv = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(
backend=DoclingParseV2DocumentBackend
)
}
)
run('/home/molokanov/input.pdf',
'/home/molokanov/output.md',
conv)
```

### Docling version
Docling version: 2.60.1
Docling Core version: 2.50.1
Docling IBM Models version: 3.10.2
Docling Parse version: 4.7.0
Platform: Linux-5.14.0-570.52.1.el9_6.x86_64-x86_64-with-glibc2.34

### Python version
Python 3.9.21

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.