Form Recognizer layout model

The Form Recognizer Layout API extracts text, tables, selection marks, and structure information from documents (PDF, TIFF) and images (JPG, PNG, BMP).

Sample form processed with Form Recognizer Studio

Screenshot of sample newspaper page processed using Form Recognizer studio

Supported document types

Model Images PDF TIFF
Layout ✓ ✓ ✓

Data extraction

Model Text Selection Marks Tables Paragraphs Paragraph roles
Layout ✓ ✓ ✓ ✓ ✓

Supported paragraph roles: The paragraph roles are best used with unstructured documents. Paragraph roles help analyze the structure of the extracted content for better semantic search and analysis.

  • title
  • sectionHeading
  • footnote
  • pageHeader
  • pageFooter
  • pageNumber

Development options

The following tools are supported by Form Recognizer v3.0:

Feature Resources Model ID
Layout model prebuilt-layout

The following tools are supported by Form Recognizer v2.1:

Feature Resources
Layout API

Try Form Recognizer

Try extracting data from forms and documents using the Form Recognizer Studio. You'll need the following resources:

  • An Azure subscription—you can create one for free

  • A Form Recognizer instance in the Azure portal. You can use the free pricing tier (F0) to try the service. After your resource deploys, select Go to resource to get your key and endpoint.

Screenshot: keys and endpoint location in the Azure portal.

Form Recognizer Studio

Note

Form Recognizer studio is available with the v3.0 API.

Sample form processed with Form Recognizer Studio

Screenshot: Layout processing a newspaper page in Form Recognizer Studio.

  1. On the Form Recognizer Studio home page, select Layout

  2. You can analyze the sample document or select the + Add button to upload your own sample.

  3. Select the Analyze button:

    Screenshot: analyze layout menu.

Input requirements

  • For best results, provide one clear photo or high-quality scan per document.

  • Supported file formats:

    Model PDF Image:
    JPEG/JPG, PNG, BMP, and TIFF
    Microsoft Office:
    Word (DOCX), Excel (XLS), PowerPoint (PPT), and HTML
    Read ✔ ✔ ✱ REST API version
    2022/06/30-preview
    Layout ✔ ✔
    General Document ✔ ✔
    Prebuilt ✔ ✔
    Custom ✔ ✔

    ✱ Microsoft Office files are currently not supported for other models or versions.

  • For PDF and TIFF, up to 2000 pages can be processed (with a free tier subscription, only the first two pages are processed).

  • The file size for analyzing documents must be less than 500 MB for paid (S0) tier and 4 MB for free (F0) tier.

  • Image dimensions must be between 50 x 50 pixels and 10,000 px x 10,000 pixels.

  • PDF dimensions are up to 17 x 17 inches, corresponding to Legal or A3 paper size, or smaller.

  • If your PDFs are password-locked, you must remove the lock before submission.

  • The minimum height of the text to be extracted is 12 pixels for a 1024 x 768 pixel image. This dimension corresponds to about 8-point text at 150 dots per inch (DPI).

  • For custom model training, the maximum number of pages for training data is 500 for the custom template model and 50,000 for the custom neural model.

  • For custom model training, the total size of training data is 50 MB for template model and 1G-MB for the neural model.

Supported languages and locales

See Language Support for a complete list of supported handwritten and printed languages.

Model extraction

The layout model extracts text, selection marks, tables, paragraphs, and paragraph types (roles) from your documents.

Paragraphs 🆕

The Layout model extracts all identified blocks of text in the paragraphs collection as a top level object under analyzeResults. Each entry in this collection represents a text block and includes the extracted text ascontentand the bounding polygon coordinates. The span information points to the text fragment within the top level content property that contains the full text from the document.

"paragraphs": [
	{
	    "spans": [],
	    "boundingRegions": [],
	    "content": "While healthcare is still in the early stages of its Al journey, we are seeing pharmaceutical and other life sciences organizations making major investments in Al and related technologies.\" TOM LAWRY | National Director for Al, Health and Life Sciences | Microsoft"
	}
]

Paragraph roles 🆕

The Layout model may flag certain paragraphs with their specialized type or role as predicted by the model. They're best used with unstructured documents to help understand the layout of the extracted content for a richer semantic analysis. The following paragraph roles are supported:

Predicted role Description
title The main heading(s) in the page
sectionHeading One or more subheading(s) on the page
footnote Text near the bottom of the page
pageHeader Text near the top edge of the page
pageFooter Text near the bottom edge of the page
pageNumber Page number
{
    "paragraphs": [
                {
                    "spans": [],
                    "boundingRegions": [],
                    "role": "title",
                    "content": "NEWS TODAY"
                },
                {
                    "spans": [],
                    "boundingRegions": [],
                    "role": "sectionHeading",
                    "content": "Mirjam Nilsson"
                }
    ]
}

Pages

The pages collection is the very first object you see in the service response.

"pages": [
	{
	    "pageNumber": 1,
	    "angle": 0,
	    "width": 915,
	    "height": 1190,
	    "unit": "pixel",
	    "words": [],
	    "lines": [],
	    "spans": [],
	    "kind": "document"
	}
]

Text lines and words

Read extracts print and handwritten style text as lines and words. The model outputs bounding polygon coordinates and confidence for the extracted words. The styles collection includes any handwritten style for lines if detected along with the spans pointing to the associated text. This feature applies to supported handwritten languages.

"words": [
    {
        "content": "While",
        "polygon": [],
        "confidence": 0.997,
        "span": {}
    },
],
"lines": [
    {
        "content": "While healthcare is still in the early stages of its Al journey, we",
        "polygon": [],
        "spans": [],
    }
]

Selection marks

Layout API also extracts selection marks from documents. Extracted selection marks appear within the pages collection for each page. They include the bounding polygon, confidence, and selection state (selected/unselected). Any associated text if extracted is also included as the starting index (offset) and length that references the top level content property that contains the full text from the document.

{
    "selectionMarks": [
        {
            "state": "unselected",
            "polygon": [],
            "confidence": 0.995,
            "span": {
                "offset": 1421,
                "length": 12
            }
        }
    ]
}

Tables and table headers

Layout API extracts tables in the pageResults section of the JSON output. Documents can be scanned, photographed, or digitized. Extracted table information includes the number of columns and rows, row span, and column span. Each cell with its bounding polygon is output along with information whether it's recognized as a columnHeader or not. The API also works with rotated tables. Each table cell contains the row and column index and bounding polygon coordinates. For the cell text, the model outputs the span information containing the starting index (offset). The model also outputs the length within the top level content that contains the full text from the document.

{
    "tables": [
        {
            "rowCount": 9,
            "columnCount": 4,
            "cells": [
                {
                    "kind": "columnHeader",
                    "rowIndex": 0,
                    "columnIndex": 0,
                    "columnSpan": 4,
                    "content": "(In millions, except earnings per share)",
                    "boundingRegions": [],
                    "spans": []
                    },
            ]
        }
    ]
}

Select page numbers or ranges for text extraction

For large multi-page documents, use the pages query parameter to indicate specific page numbers or page ranges for text extraction.

Next steps