docling-project / docling-project/docling

Documents output filled with GLYPH word

Open
#1,744 2 comments 3 reactions 1 assignee Claimed by @cau-git View on GitHub
bug triage/close-stale
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
Docling sometimes produces unreadable output after converting document. For example
(force_full_page_ocr set to False)
```
## PRZEDMIAR ROBÓT

!GLYPH<15>GLYPH<20>GLYPH<22>'()GLYPH<23>GLYPH<20>GLYPH<18>*GLYPH<20>GLYPH<4>GLYPH<16>GLYPH<17>+,-GLYPH<4>GLYPH<21>.GLYPH<13>GLYPH<4>GLYPH<8>GLYPH<22>/,GLYPH<15>01.GLYPH<17>GLYPH<4>"GLYPH<19>GLYPH<17>GLYPH<21>0)GLYPH<23>GLYPH<20>GLYPH<4>#GLYPH<20>2,GLYPH<21>)13
```
(force_full_page_ocr set to True)
```
- " wykonanie tynkéw, tynkéw uzupetniajacych, posadzek, oktadzin, malowanie,
- "montaz nowej stolarki okiennej i drzwiowej zwiazanej z rozbudowa,
- "uzupeinienia remontowe na elewacjach z malowaniem.

| GLYPH<31>/GLYPH<13>
| GLYPH<1>GLYPH<17>5'GLYPH<18>*1GLYPH<4> GLYPH<23>GLYPH<17>GLYPH<22>5-GLYPH<17>GLYPH<16>'GLYPH<22>GLYPH<17>GLYPH<28> GLYPH<21>1
GLYPH<20>5GLYPH<21>GLYPH<20>
```

Related issue: https://github.com/docling-project/docling/issues/185
`OcrOptions.force_full_page_ocr` helps a little, but not completely. With this option it breaks when it tries to parse table

[Example, not confidential document](https://github.com/user-attachments/files/20672460/przedmiary.pdf)
with force_full_page_ocr=True it breaks after 3rd page (inclusive)
...

### Steps to reproduce
```
pipeline_options = PdfPipelineOptions()
accelerator_options = AcceleratorOptions(num_threads=8, device=AcceleratorDevice.CPU)
pipeline_options.accelerator_options = accelerator_options

pipeline_options.do_ocr = True
pipeline_options.do_table_structure = True
pipeline_options.table_structure_options.do_cell_matching = True
pipeline_options.allow_external_plugins = True
pipeline_options.generate_page_images = True
pipeline_options.generate_picture_images = True
pipeline_options.do_picture_description = False
settings.debug.profile_pipeline_timings = True
ocr_options = TesseractCliOcrOptions(force_full_page_ocr=True)
pipeline_options.ocr_options = ocr_options

formatter_option = PdfFormatOption(
pipeline_options=pipeline_options,
)

converter = DocumentConverter(
format_options={
InputFormat.PDF: formatter_option,
InputFormat.IMAGE: formatter_option # Docling uses same pipeline for PDF and Images, so it's okay
}
)

doc = converter.convert("./data/examples/przedmiary.pdf").document
print(doc.export_to_markdown())
```
This code uses TesseractOCR, but the bug occurs even if I deliver complete, proper OCR result from external source, so it's not OCR bug

### Docling version
```
Docling version: 2.33.0
Docling Core version: 2.31.1
Docling IBM Models version: 3.4.3
Docling Parse version: 4.0.1
Python: cpython-312 (3.12.9)
Platform: Linux-6.13.10-200.fc41.x86_64-x86_64-with-glibc2.41
```

### Python version
`Python 3.12.9`

Other issues say that changing PDF backend might help, but on the same time they claim this change breaks other files

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.