# Document Layout Analysis: Reading Order, Tables, and Page Structure

> Document layout analysis finds the regions, element types, reading order, and table structure on a page so text keeps its context in extraction and RAG.

Canonical: https://reducto.ai/guides/document-layout-analysis

## What is document layout analysis?

Document layout analysis is the step that maps a page's structure before anyone uses its text. It finds the regions on a page, labels each one (title, heading, paragraph, table, figure, header, footer), records where each sits, and decides the order a person would read them in. OCR tells you which characters are on the page. Layout analysis tells you how they are grouped and what role each group plays.

It applies to native PDFs, Office files, and scans. Without it, a two-column report or a filing with tables becomes one long stream of words, and search, extraction, and LLM retrieval all inherit that confusion.

This guide covers layout analysis specifically. For the full parsing workflow, from ingestion to integration, see our [document parsing guide](https://reducto.ai/guides/document-parsing-unstructured-files).

## What document layout detection finds

Layout analysis usually runs in three stages:

1. **Region detection.** Draw a boundary around each distinct area of content, such as a paragraph, a table, a chart, or a running header.
2. **Classification.** Give each region a type, so a caption is not treated as body text and a page number is not treated as a value.
3. **Reading order detection.** Arrange the regions in the sequence a human would follow, across columns, sidebars, and pages.

The result has two parts: the physical layout (where each element is on the page) and the logical layout (what each element means in the document).

## Regions and element types

The element types that matter most in practice:

<Table html={"<table>\n  <thead>\n    <tr>\n      <th>Element</th>\n      <th>Why the type matters</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>Title and section headers</td>\n      <td>Define the hierarchy and natural boundaries for chunking</td>\n    </tr>\n    <tr>\n      <td>Body text and list items</td>\n      <td>Hold the main content; lists should stay together</td>\n    </tr>\n    <tr>\n      <td>Tables</td>\n      <td>Need row and column structure, not just their words</td>\n    </tr>\n    <tr>\n      <td>Figures and captions</td>\n      <td>Need to stay paired so the caption explains the right chart</td>\n    </tr>\n    <tr>\n      <td>Key-value pairs</td>\n      <td>Connect a label such as \"Total\" to its value on forms</td>\n    </tr>\n    <tr>\n      <td>Page headers, footers, and page numbers</td>\n      <td>Repeat on every page and are usually noise for search</td>\n    </tr>\n  </tbody>\n</table>"} />

Each region also gets a position, usually a bounding box and page number, so an application can highlight the source of an answer or show a reviewer where a value came from.

## Reading order and table structure

Reading order is the hardest part of page layout analysis on real documents. A two-column page should be read down the left column and then down the right. A sidebar should not be spliced into the middle of a paragraph. A header that repeats on every page should not interrupt a sentence that runs across a page break.

Tables need their own structure analysis. Detecting that a region is a table is only the first step. The parser also has to recover rows, columns, header cells, merged cells, and nested headers. Our [table parsing write-up](https://reducto.ai/blog/sota-table-parsing) explains why spanning cells and multi-level headers break simpler table pipelines.

## How layout analysis is built

There are three broad approaches:

- **Rules.** Heuristics on margins, font size, and whitespace. Cheap and predictable, but brittle when templates change.
- **Classical machine learning.** Classifiers on hand-built features. More flexible, but weak on unusual layouts.
- **Deep learning.** Vision and layout-aware models that label regions from the page image. Best across mixed documents, at higher compute cost.

Most production pipelines use learned models and keep rules for tightly controlled forms.

## Why flat text loses context

Here is a synthetic one-page report with two columns: numbered sections on the left, and a table plus an outlook section on the right. Extracting it with a plain text tool in layout mode (`pdftotext -layout`) keeps the columns side by side, so each output line mixes the two:

```text
 1. Volume                                                      Table 1. Shipments by region
                                                                  Region    Q2 shipments   Q3 shipments   On-time %
 Shipment volume rose in every region this quarter.
 The largest gain came from the Central hub, where                North     12,400         13,050         96.1
 a new sorting line opened in the second month.                   Central   18,200         21,900         94.8
```

A chunker or LLM reading these lines sees a sentence about the Central hub beside an unrelated table row. Column boundaries exist only as spaces, so "13,050" has no reliable link to "Q3 shipments" or "North." Contracts with side notes, two-column papers, and statements with transaction tables fail the same way.

## Inspect a structured Parse result

[Reducto Parse](https://reducto.ai/parse) runs layout analysis as part of parsing. The response contains chunks, and each chunk contains typed blocks with a bounding box, a page number, and a confidence value. The [response format docs](https://docs.reducto.ai/parse/response-format) list the block types, including `Title`, `Section Header`, `Header`, `Footer`, `Text`, `Table`, `Figure`, `Key Value`, and `List Item`. Box coordinates are normalized from 0 to 1 relative to the page.

We ran the same synthetic page through Parse with `settings.model` set to `"r-1"`. This is the trimmed block list, in the order returned:

```json
[
  { "type": "Header",         "content": "Northwind Logistics | Quarterly Operations Review (synthetic)" },
  { "type": "Title",          "content": "<b>Q3 Operations Summary</b>" },
  { "type": "Section Header", "content": "<b>1. Volume</b>",
    "bbox": { "left": 0.099, "top": 0.156, "width": 0.107, "height": 0.013, "page": 1 } },
  { "type": "Text",           "content": "Shipment volume rose in every region this quarter..." },
  { "type": "Section Header", "content": "<b>2. Delivery performance</b>" },
  { "type": "Text",           "content": "On-time delivery held steady despite higher volume..." },
  { "type": "Section Header", "content": "<b><i>Table 1. Shipments by region</i></b>" },
  {
    "type": "Table",
    "content": "<table><tr><th><b>Region</b></th><th><b>Q2 shipments</b></th><th><b>Q3 shipments</b></th><th><b>On-time %</b></th></tr><tr><td>North</td><td>12,400</td><td>13,050</td><td>96.1</td></tr>...</table>",
    "bbox": { "left": 0.53, "top": 0.17, "width": 0.363, "height": 0.093, "page": 1 },
    "confidence": "high"
  },
  { "type": "Section Header", "content": "<b>3. Outlook</b>" },
  { "type": "Text",           "content": "Next quarter we will extend the sorting line..." },
  { "type": "Footer",         "content": "Page 1" }
]
```

Three things to check in output like this:

- **Reading order.** The left column comes out complete before the right column starts.
- **Typed regions.** The running header and the page number are labeled `Header` and `Footer`, so you can drop them from retrieval with the `filter_blocks` option described in the [Parse best practices](https://docs.reducto.ai/parse/best-practices).
- **Table structure.** The table is a single block with header and data cells as HTML, and its `bbox` places it in the right column (`left` 0.53). HTML can represent merged cells, which Markdown tables cannot.

According to the [r-1 docs](https://docs.reducto.ai/parse/r-1), r-1 returns layout, reading order, tables, and figures without extra configuration, and resolves columns, headers, footers, and sidebars. To inspect your own documents, upload a file in [Reducto Studio](https://studio.reducto.ai) and compare the blocks against the page.

## Frequently asked questions

### Is document layout analysis the same as OCR?

No. OCR converts pixels into characters. Layout analysis groups those characters into regions, labels them, and orders them. Native digital PDFs may not need OCR at all, but they still need layout analysis.

### What is reading order detection?

It is the step that decides the sequence in which a page's regions should be read. It matters most on multi-column pages, pages with sidebars or callouts, and content that continues across pages.

### Why does layout analysis matter for RAG?

Chunks built from correctly ordered, typed blocks keep headings with their sections and tables in one piece. That gives retrieval complete context and lets you cite the exact page region behind an answer.

### Do I need a separate layout model before calling an LLM?

Not if your parser already returns typed blocks, positions, and table structure. Reducto Parse returns all three, so you can pass `content` to an LLM and keep the blocks for citations.
