Bug
Figure captions and headings where every word boundary space is lost, producing a single concatenated CamelCase string. This happens when the PDF producer stores the text as a single TJ text run with explicit kerning but no inter-word gaps.
Example from a real PDF:
Causeofdeathperlegaloutcomefornon-humancasesintheNetherlands
Should be:
Cause of death per legal outcome for non-human cases in the Netherlands
Steps to reproduce
from docling.document_converter import DocumentConverter
converter = DocumentConverter()
result = converter.convert("verkerk_forensic_necropsies_2026.pdf")
md = result.document.export_to_markdown()
# The figure caption has no spaces between words
assert "Causeofdeathperlegaloutcome" in md # Bug
Expected behavior
The extractor should detect word boundaries even when the PDF stores the text as a single kerned run. Inter-word spaces should be preserved.
Source location
page_assemble_model.py:118 sanitize_text / backend/docling_parse_backend.py - glyph-to-space conversion is missing for uniformly-spaced runs. The PDF producer wrote the heading as a single Tj/TJ text run with negative kerning but no inter-word Tm gap. The extractor reads ( ) TJ entries as kerning rather than as space tokens.
Suggestion
Track glyph bboxes and inject a space when next.x0 - cur.x1 exceeds approximately 0.2 times the average glyph width. Alternatively, detect runs where the inter-glyph spacing is uniform (no variation) and apply a word-boundary heuristic based on common English word patterns.
Docling version
2.115.0
Regression test PDF
verkerk_forensic_necropsies_2026.pdf (4.4 MB) - figure caption with CamelCase collapse visible in the markdown output
Bug
Figure captions and headings where every word boundary space is lost, producing a single concatenated CamelCase string. This happens when the PDF producer stores the text as a single TJ text run with explicit kerning but no inter-word gaps.
Example from a real PDF:
Should be:
Steps to reproduce
Expected behavior
The extractor should detect word boundaries even when the PDF stores the text as a single kerned run. Inter-word spaces should be preserved.
Source location
page_assemble_model.py:118 sanitize_text/backend/docling_parse_backend.py- glyph-to-space conversion is missing for uniformly-spaced runs. The PDF producer wrote the heading as a single Tj/TJ text run with negative kerning but no inter-word Tm gap. The extractor reads ( ) TJ entries as kerning rather than as space tokens.Suggestion
Track glyph bboxes and inject a space when
next.x0 - cur.x1exceeds approximately 0.2 times the average glyph width. Alternatively, detect runs where the inter-glyph spacing is uniform (no variation) and apply a word-boundary heuristic based on common English word patterns.Docling version
2.115.0
Regression test PDF
verkerk_forensic_necropsies_2026.pdf(4.4 MB) - figure caption with CamelCase collapse visible in the markdown output