Feature request: the document without table structure from the same conversion (one layout pass)
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Read the PageAssembleModel and ReadingOrderModel behavior described in the issue, then inspect Page.assembled and StandardPdfPipeline._assemble_document to find a suitable public API. Compare the proposed result with a separate conversion using do_table_structure=False, including Markdown output, page count, tables, pictures, and page numbering; done means the public path matches that conversion without running another model pass.
Written by the indexing model from the issue text.
Description
Requested feature
A public way to get, from one PDF conversion, the document with table structure (TableFormer) and the same document without it (what do_table_structure=False produces). Today the only public way to get both is to convert twice, which runs the layout model over every page twice.
Use case
A scientific-paper ingestion pipeline keeps two Markdown exports per paper:
- the table-structured one, for tables;
- the unstructured one, whose text is the stored, hashed source for downstream steps (sections, page-1 metadata).
Changing the unstructured export would invalidate everything stored from it, so it must stay byte-identical. Converting twice per paper costs roughly a quarter of the conversion time on our CPU-only hosts: the layout pass runs twice.
What we found (Docling 2.143.1, docling-core 2.105.0)
Without a table-structure prediction, PageAssembleModel falls back to Table(otsl_seq=[], table_cells=[], cluster=cluster, ...). ReadingOrderModel then adds the cluster's children under the table as a group. So after a conversion with do_table_structure=True, the unstructured document can be rebuilt without running any model:
result = converter.convert(source) # do_table_structure=True
structured = result.document
for page in result.pages:
if page.assembled is None:
continue
swap = {id(e): Table(label=e.cluster.label, id=e.cluster.id, text="", otsl_seq=[], table_cells=[],
cluster=e.cluster, page_no=page.page_no)
for e in page.assembled.elements if isinstance(e, Table)}
for name in ("elements", "body", "headers"):
setattr(page.assembled, name, [swap.get(id(e), e) for e in getattr(page.assembled, name)])
pipeline = converter._get_pipeline(InputFormat.PDF)
unstructured = pipeline._assemble_document(result).document
On the papers we checked (19 and 46 pages, 12 and 29 tables), the export_to_markdown() of unstructured is identical to a separate do_table_structure=False conversion, including page_no=1. So are num_pages(), the table items (1×1 data plus the child group) and the picture items. The re-assembly takes 1–3 s.
It relies on two internals, Page.assembled and StandardPdfPipeline._assemble_document, so it can break on any release.
Proposal
One of these as public API, whichever fits the design better:
- a
PdfPipelineOptionsflag (for examplealso_produce_unstructured_tables: bool) that adds a second document to theConversionResult; or - a public method, for example
StandardPdfPipeline.reassemble(conv_res, table_structure=False) -> DoclingDocument(or onConversionResult), documented as running no model.
We are happy to open a PR for either, with a test that compares against a do_table_structure=False conversion.
Alternatives considered
- Two conversions: what we do today, at the cost of a second layout pass.
- A custom Markdown table serializer over the structured document: public API, but the output is not identical to the unstructured conversion. The cell order and tokenization differ.
- Dominant language
- Python
- Stars
- 71k
- Forks
- 5.4k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 161
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from docling-project/docling
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
docling-project/docling#5592 ·
Maintainers usually reply within 2 days
-
`api_image_request` logs and propagates the raw error response body, leaking the request's API key on 401Possibly taken @prassu017 claimed this 7 days ago. Openbug priority:critical
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
docling-project/docling#5486 · 1 comment · 1 reaction ·
Maintainers usually reply within 2 days
-
AFP: export_to_doctags() raises ZeroDivisionError because every page has size 0x0Possibly taken @Krushil-Dhankecha claimed this 12 days ago. Openbug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
docling-project/docling#5355 · 1 comment ·
Maintainers usually reply within 2 days
-
AsciiDoc: thematic breaks and page breaks are kept as text or turned into list itemsPossibly taken @sohailshk claimed this 12 days ago. Openasciidoc bug priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
docling-project/docling#5331 · 1 comment ·
Maintainers usually reply within 2 days
-
Merged paragraph across pages of different heights: continuation bbox uses the first page's heightPossibly taken @galer1us claimed this 15 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
docling-project/docling#5286 ·
Maintainers usually reply within 2 days
All issues in docling-project/docling
Similar issues
-
app: scripts status: backlog type: housekeeping
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
netbox-community/netbox-scripts#239 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
LmeSzinc/AzurLaneAutoScript#6194 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
micronaut-projects/micronaut-core#14585 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
langgenius/graphon#443 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day