Rachis

How do you fix PDF tables and broken reading order?

28 November 2026

Your PDF table comes back with rows merged into one line or values under the wrong column, and answers that depend on it are wrong. On two-column pages, the text can run straight across both columns.

The structure can be lost in extraction, when the extracted table is written out as text such as Markdown, or when the text is split into passages for search. Compare each stage's output with the page before changing settings, and keep questions that depend on the table to test the change.

Compare the extracted output with the page

A parser is software that extracts a document's text and structure. Choose a few failing pages and keep each original beside the parser's output.

Table structure is the arrangement of cells into rows and columns, including cells that span several rows or columns. Compare each row's label and values with the page. Check that column headings still apply to the values beneath them, empty cells remain in the right places, and spanning headings cover the intended columns.

On pages with multiple columns, check reading order, the sequence in which the extracted text runs, which should match how a person reads the page. Read across paragraph boundaries to see whether text from one column has been inserted into another.

If a table page comes back empty or unreadable, the problem starts before table structure. The PDF and scan extraction guide covers pages without selectable text and optical character recognition (OCR), which reads text from page images.

Compare export formats of the same table

If your parser can write the same table in more than one format, compare them. Docling, for example, exports Markdown, a text format with markers for structure, and HTML, the language of web pages. If one preserves the table and another loses it, inspect that conversion first.

One Docling user reported that the Markdown output showed a table with a wrong last row, which Docling's HybridChunker, the component that splits documents into passages, then broke apart. A commenter traced the wrong row to how spanning cells are written out.

In the commenter's account, the recognized structure was correct, but Docling's table grid copies a spanning cell's text into every grid position it covers. Both the Markdown export and the HybridChunker read that grid, and the HTML export of the same table was correct. The issue remains open.

An application can divide extracted text into passages, pieces prepared for search and often called chunks. Inspect the actual stored passages as well as the parser's output.

One RAGFlow user reported that table rows were merged after upgrading from v23.1 to v25.6 with RAGFlow's DeepDoc parser.

Run on its own, DeepDoc's OCR and structure recognition script kept the structure. In RAGFlow's "Chunk result" view, which shows the chunks used for embedding and retrieval, tables were flattened and rows that should be separate were concatenated into one chunk. The issue was closed without a reported fix.

Pin the versions of your parser and of your splitter, the component that divides its output into passages, and repeat these comparisons before accepting an upgrade. Save the previous version's output so you can compare the same pages.

Where your splitter allows it, put each table, its title and its column headings in one passage. When dividing documents into passages, check that no row has been detached from its column labels. A row of amounts separated from its labels no longer states which amount belongs to which category.

Change the setting at the failing stage

If the parser output is intact and only stored passages differ, test the splitter first. If one export format keeps the table and another does not, use or fix that export. Otherwise, compare parser settings on the same failing pages.

In Unstructured, the strategy setting chooses how a PDF is read. Its hi_res strategy, the only one that currently extracts PDF tables, identifies the document's layout with detectron2_onnx and falls back to ocr_only when detectron2_onnx is not available. If tables come back flat, check which strategy ran.

For a document with multiple columns and no extractable text, the same page recommends ocr_only, because hi_res currently has difficulty ordering elements in such documents. That choice gives up table extraction.

In Docling, table structure recognition runs with do_table_structure=True, using TableFormer, Docling's table structure model. Its default TableFormerMode.ACCURATE gives better quality on difficult table structures; FAST is faster but less accurate.

By default, Docling maps the recognized table structure back to PDF cells. Its documentation says that setting do_cell_matching=False, which uses text cells from the structure prediction itself, can improve output when several columns of an extracted table are merged into one.

pdfplumber works best on machine-generated PDFs rather than scans. By default, extract_tables uses the page's lines or rectangle edges as cell separators. For tables with no drawn lines between cells, set vertical_strategy and horizontal_strategy in table_settings to text, which deduces cell borders from how words line up; explicit uses only lines you define.

Keep locations and test the repair

Keep each table's page number and position with its passages when splitting the text, so a citation can open the source table on the correct page.

Add a few table-dependent questions to your test set, each with its checked answer and the source rows and columns that settle it. Include questions that need a spanning heading, or values from rows where a page break or passage boundary splits the table, if your documents contain those structures.

After changing a parser, setting or version, compare the extracted table and stored passage again. Then check which passages search returns for each question. Inspect the application's request for the model, containing the question and selected passages, to confirm the table arrives intact.

Finally, read the answer and open its citations. If search returns the right table but the request loses its headings, fix how the application assembles the request before changing the parser again.

Where Rachis fits

Getting tables into an AI application means connecting extraction, search and answer generation. Connect your app to the Rachis API instead. Rachis runs the entire pipeline on your documents and returns the results, without you assembling the plumbing between those steps.

Join the waitlist: one email when there is something to try.

Read the pain map: Ingestion.