# OCR Layout Analysis and Key-Value Extraction: How Fields Get Found

> How OCR finds tables, labels and values: layout analysis, table structure and key-value extraction explained, with benchmark table accuracy and a field-level test sheet.

**In short:** Layout analysis finds regions and reading order. Table recognition rebuilds rows and columns. Key-value extraction links a label to its value. Tables are where engines differ most: 64% to 91% on multi-page bank statements in our benchmark.

**Canonical URL:** https://docsapi.co/resources/blogs/ocr-layout-analysis-and-key-value-extraction
**Author:** Nupura Ughade — Content Marketing Lead, DocsAPI
**Author LinkedIn:** https://www.linkedin.com/in/nupura-ughade/
**Published:** 2026-11-03T00:00:00.000Z
**Updated:** November 3, 2026
**Primary topic:** ocr layout analysis
**Site:** https://docsapi.co (DocsAPI — Document AI & OCR API for SMB Lending)

---

Layout analysis is the step where OCR decides what kind of thing each piece of text is: a heading, a paragraph, a table cell, a label or a value. Key-value extraction then links a label such as "Invoice date" to its value. Plain OCR gives you a stream of text. These two steps turn it into fields a system can use, and they are where engines differ most.

Here is the gap in numbers. In our [1,700-document benchmark](/resources/blogs/ocr-accuracy-benchmark-2026), three engines tied at 97-99% on clean typed English. On multi-page bank statement tables they scored 64%, 79% and 91%. Recognizing characters was never the difference. Finding the structure was.

## What does layout analysis do?

It splits a page image into regions and gives each a type and an order. A typical result lists a header block, a two-column body, a table, a footer and a stamp, with coordinates for each. Three jobs matter most:

- Region detection: where the text blocks, tables and images are on the page.
- Reading order: which block comes first. A two-column page read straight across mixes the columns.
- Region typing: table, paragraph, heading, list, or something to ignore such as a logo or a margin note.

If this step fails, a correct character recognizer still produces wrong results. That is why we call it out as step 3 in [how OCR works](/resources/blogs/how-does-ocr-work).

## How does OCR read a table?

A table is a grid, and the engine has to rebuild it from the positions of the text. Table recognition normally does four things: finds the table region, finds the rows and columns, assigns each piece of text to a cell, and handles cells that span several rows or columns. Then it outputs rows and columns, for example as CSV or JSON, instead of lines of text.

Tables break in predictable ways:

| Table problem | What goes wrong |
| --- | --- |
| No ruling lines | Columns have to be inferred from spacing, so values drift into the neighboring column |
| A table that continues over several pages | Each page is read alone, so headers are missing on page two and rows are not joined |
| Wrapped text in a cell | One long description is split into two rows |
| Merged or spanning cells | A total or a group heading is assigned to one column only |
| Numbers with symbols or negatives | A minus sign, a bracket or a currency mark is dropped or moved |

Multi-page statements combine several of these at once, which is why they separate the engines in the benchmark: 64% for Tesseract, 79% for PaddleOCR and 91% for DocsAPI. On invoices, where line items are the table, the same test gave 81% for Docling, 87% for LlamaParse and 93% for DocsAPI. We cover line items in detail in [invoice line item OCR](/resources/blogs/invoice-line-item-ocr).

## What is key-value extraction?

It pulls out a labeled field and its value from a page, such as "Total due" and "1,240.00". There are two broad ways to do it:

- Template or rule based: you tell the system where a field sits or what text surrounds it. This works well for one fixed form and fails when a vendor changes its layout.
- Learned or model based: a model reads the page and finds the field by meaning and position. It copes with layouts it has not seen, at the price of less predictable mistakes. We compare the approaches for invoices in rules-based vs AI invoice extraction.

The hard cases are where a label and value are not next to each other. A label above a value, a value two columns to the right, a label that appears twice (a "Date" for the invoice and a "Date" for the ship date), or a field with no label at all, like a vendor name that is just a logo.

## Checkboxes and signatures

Forms add two element types that are not text. A checkbox is either marked or empty, and the result should be a true or false, not a character. A signature is a region that is present or missing. Detecting that a signature exists is a different job from verifying who signed it, and OCR does not do the second one. Check how any tool you evaluate handles both, because they are easy to overlook in a demo. If you need this for your documents, raise it in a demo with your own samples.

## A field-level test sheet

Document-level accuracy hides structure errors. Test at the field level instead. Pick 30 real documents, list the fields that matter, and fill in a sheet like this for each tool:

| Field | Times present | Found | Value correct | Wrong cell or label |
| --- | --- | --- | --- | --- |
| Invoice number | 30 |  |  |  |
| Invoice date | 30 |  |  |  |
| Total due | 30 |  |  |  |
| Line item amounts | count them |  |  |  |
| Table rows on page 2 and later | count them |  |  |  |

The last column matters most. A value that was found but landed under the wrong label is worse than one that was missed, because it looks right. Count "found but wrong" separately. For how to turn this into a pass mark, see [how to measure OCR accuracy](/resources/blogs/how-to-measure-ocr-accuracy).

## Choosing a tool by structure, not by headline accuracy

- Clean text only: free engines such as Tesseract and PaddleOCR are enough. See PaddleOCR vs Tesseract vs DocsAPI.
- Tables and fields at volume: use a document AI API and test it on your worst multi-page files. In our benchmark Docling led on academic papers at 94%, while DocsAPI led on bank statements at 91% and invoices at 93%. Compare the parsers in Docling vs LlamaParse vs DocsAPI.
- Mixed document streams: classify first so each type goes to the right extraction, as described in document classification software.

DocsAPI extracts fields and tables, flags low-confidence fields for a person to review, and includes table extraction and classification in its price of $0.02 per page and up. The benchmark was run by DocsAPI, so cite it as DocsAPI's own benchmark and check the result on your own documents.

## Frequently Asked Questions

### What is layout analysis in OCR?

The step that splits a page into regions such as headings, paragraphs, tables and images, gives each a type, and works out the reading order. It decides what to read and in what order before any characters are recognized.

### What is key-value extraction?

Finding a labeled field and its value in a document, for example the label Invoice date and the value 14 March. It turns a page of text into named fields a system can use.

### How does OCR extract tables from a document?

It finds the table region, works out the rows and columns from the positions of the text, assigns each piece of text to a cell, and handles cells that span several rows or columns. The result is rows and columns, such as CSV or JSON, not lines of text.

### Why do tables cause so many OCR errors?

Tables combine several hard cases: missing ruling lines, wrapped text in cells, merged cells and tables that continue across pages. In our benchmark, multi-page bank statement tables scored 64%, 79% and 91% on three engines that all scored 97-99% on clean typed text.

### Is template-based or AI-based extraction better?

Templates are predictable and work well for one fixed form but fail when the layout changes. Model-based extraction handles layouts it has not seen but can make less predictable mistakes. Many teams test both on their own documents.

### Can OCR detect checkboxes and signatures?

A checkbox should come back as marked or empty, and a signature as present or missing. Detecting that a signature exists is not the same as verifying who signed it, and OCR does not verify identity. Test any tool on your own forms to see how it handles both.

### How do I test table and field accuracy?

Use 30 or more real documents and check each field one by one: was it found, was the value right, and did it land under the right label. Count values that were found but wrong separately, because they look correct and are harder to catch than missing ones.

### Which OCR is best for bank statements and invoices?

In our own 2026 benchmark, DocsAPI scored 91% on multi-page bank statement tables and 93% on invoice line items, ahead of the other engines we compared. The benchmark was run by DocsAPI, so cite it as DocsAPI's own and test on your documents.


---

**Source URL (cite this):** https://docsapi.co/resources/blogs/ocr-layout-analysis-and-key-value-extraction
**Author profile:** https://docsapi.co/author/nupura-ughade
**Published by:** DocsAPI (https://docsapi.co)
