Skip to main content

Overview

Document parsing reads a file such as a digital PDF or a scan of a paper document, and returns its content as structured elements: titles, headings, paragraphs, lists, tables, figures, formulas, and more. Each element is placed in reading order and tied to its position on the page. Where a raw text dump loses the layout that gives a document its meaning, Meibel recovers that layout and returns content a program can act on. The output has the same shape whether the source was a clean digital PDF, a skewed scan, or a phone photo of a document out in the world.

What parsing recovers

Meibel reads a document the way its layout intends, recovering the structure a flat stream of characters would lose. Structure by content role. A layout model labels every region by its role, spanning text, tables, figures, and page furniture. A Title or SectionHeader carries a level from H1 to H6, so the section hierarchy survives into the output. The full catalog is available in element types. Tables as addressable grids. A table returns as a grid of cells, each with its row and column position and any spans, so a program reads it by coordinate rather than from whitespace. Charts as data, and recognition of formulas and seals. Charts, formulas, seals, and pictures are all read by vision-language models, and line and scatter charts are also digitized back into their series. See charts, formulas, and vision models. Text from scans. Pages without an extractable text layer go through OCR automatically, decided page by page, with orientation corrected first and a large multilingual character set covered. Position and confidence on every element. Each element carries a bounding box you can trace to the source, and a confidence score a downstream step can gate on.

The pipeline

The stages below run connected by channels, so pages flow from one stage to the next and the work parallelizes across pages. A page that needs neither recognition nor a vision model passes through the stages that do not apply to it without waiting. This is what keeps large documents fast while still handling the hard pages thoroughly.

Text extraction

The first stage reads the document’s own contents. For a digital PDF this means walking the file’s structure and its content streams to recover every character, its font, and its position. The output is a set of positioned characters, because a PDF stores text as placed glyphs rather than as sentences. From those glyphs the stage assembles words and lines by their geometry, so characters sitting together become a word and words on a shared baseline become a line. This path is pure work over the file itself, with no model involved, which is why a text-based PDF parses quickly. Encrypted PDFs are decrypted where possible, and content nested inside reusable form objects is followed so its text is not missed.

Orientation and optical character recognition

A page can arrive with no readable text layer, as scans and photographs do, or rotated, as faxed pages often are. A page that needs recognition has its orientation assessed and corrected: a page turned ninety, one hundred eighty, or two hundred seventy degrees is set upright along with the coordinates of anything already extracted from it. It then goes through OCR, which reads characters directly from the image and covers a large multilingual character set. Skew finer than a quarter turn is handled at this stage rather than by rotating the page. Whether a page needs OCR is decided page by page. A scorer weighs several signals from the page: the quality of any embedded text encoding, whether text is present but invisible, how rich the fonts are, how much of the page is image, and whether the text reads coherently. A page with a clean text layer skips OCR and stays fast, while a scanned or garbled page is recognized from its image. A recognized page rejoins the pipeline in the same form as extracted text.

Layout analysis

Positioned lines alone do not say what a line is. A layout model looks at the rendered page and divides it into regions, labeling each with its content role. This labeling is what lets later stages and your own code treat a heading differently from body text, a table apart from prose, and a chart apart from a photograph. Layout analysis reads the visual page, so it uses the same signal a person does: size, position, spacing, and emphasis. The text lines are then matched into the regions that contain them. Pages are analyzed in batches for efficiency. When a page is detected as a line-numbered legal transcript, the numbers running down its gutter are lifted out of the body text and kept separately, each with its own position. The prose then reads continuously, and page and line citations into the transcript stay resolvable.

Recognizing tables

A region labeled as a table still needs its internal grid rebuilt, because a PDF does not record which text belongs to which cell. A table model recovers its rows, its columns, and the cells within them, including cells that span more than one row or column, and the text lines are matched into those cells by position. A sanity check guards against grids produced from content that is not really tabular, treating a degenerate grid as ordinary text instead.

Charts, formulas, and other recognized regions

Regions that ordinary recognition handles poorly are read by vision-language models. A formula, a chart, a seal, or a picture is cropped and sent to a model that returns structured content, and a chart drawn as vector graphics is digitized from its geometry in parallel. This stage fans out the eligible regions on a page concurrently, and a page with none of them passes through at once. The details of this stage are in charts, formulas, and vision models.

Reading order

The regions on a page are found by their position, which may not match the order a person reads them in. For example, a two-column article, a page with a sidebar, or a layout with footnotes would read incoherently if taken strictly top to bottom, left to right. The ordering stage sequences the regions into human reading order, keeping page headers and footers apart from the body and associating captions and footnotes with what they belong to.

Rendering the result

The stages above produce one internal representation: ordered, typed, positioned elements, with tables as grids and charts as data. The final stage renders that representation into the rendering you requested. Because every rendering derives from the same representation, they agree with each other, and requesting a second one re-renders rather than re-parses. See the parsed document and choosing an output format.

Start here

Parse your first document

A guided walk from a PDF on disk to structured output.

The parsed document

The element model the pipeline produces.

Charts, formulas, and vision models

How charts, formulas, seals, and images are recognized.

Output schema

Every field in the structured result.