Document parsing: how it works, methods, tools and use cases
For operations, finance and engineering teams: what document parsing is, the steps from file to structured data, how rule-based, AI and LLM parsers compare, the tools available, and how to choose.

Key takeaways
- Document parsing is converting a document, such as a PDF, scan, Word file or email, into structured data: named fields, tables and text in reading order.
- The pipeline is text extraction or OCR, layout analysis, classification, field and table extraction, validation and export.
- There are three approaches: rule-based parsers for fixed layouts, AI and document AI parsers for varied layouts, and LLM-based parsers that turn documents into clean text or JSON.
- Parsing for business data (the total on an invoice) and parsing for AI search and RAG (a PDF as clean markdown) are different jobs with different tools.
- Choose a parser by accuracy on your documents, table handling, validation and review, and integration, not by format support alone.
On this page
Document parsing is the process of turning a document, such as a PDF, a scan, a Word file or an email, into structured data that software can use: named fields, tables and text in the right reading order. A parser reads the file, works out its layout, identifies the values you need, such as the invoice number, the policy dates or every transaction on a statement, and outputs them as JSON, CSV or records in another system.
This guide covers how document parsing works, the three main approaches, the tools, common use cases, and how to choose a parser.
What is document parsing?#
Parsing means analyzing input and giving it structure. For data formats like JSON, the structure is already in the data (see our guide to data parsing). Documents are harder, for three reasons:
Digital PDFs have no structure
A PDF stores characters at positions on a page, with no notion of "this is a table row" or "this is the total."Scans have no text
A scan or photo is just an image; there's no text until OCR reads it.Layouts vary
Every vendor's invoice and every bank's statement puts the same information in a different place.
A document parser has to rebuild structure from what's on the page.
How document parsing works#
- Digital PDFs
- Scans and photos
- Word files
- Emails
- 01Get the text
- 02Analyze the layout
- 03Classify
- 04Extract fields and tables
- 05Validate
- Get the textRead the text layer from digital PDFs and Word files; run OCR on scans and images.
- Analyze the layoutFind blocks, columns, headings, tables and reading order, and keep each word's position.
- ClassifyIdentify the document type, and split files that contain several documents.
- ExtractPull the fields and tables you need, as key-value pairs and rows.
- NormalizeConvert dates, amounts and names to standard formats.
- ValidateCheck required fields, formats and totals, and cross-check against other documents.
- ReviewSend low-confidence values or failed checks to a person.
- ExportDeliver JSON, CSV or Excel, or push the data to your systems by API or webhook.
Rule-based, AI and LLM parsers#
| Approach | How it works | Good for | Limits |
|---|---|---|---|
| Rule-based | Templates, zones, anchors and regex locate each field | A few stable layouts | Each new layout needs new rules; changes break them |
| Document AI | Models trained per document type find fields and tables by content and layout | Many layouts, scans, multi-page tables, high volume | Needs models for your document types; test before you commit |
| LLM-based | A language or vision model reads the page and returns text, markdown or JSON | Unusual documents, prototypes, preparing documents for search and RAG | Can return plausible wrong values; needs a schema and validation |
In practice, production platforms combine them: document AI models for known types, an LLM prompt for a new layout, and rules for validation.
Two different parsing jobs
Parsing for business data means specific values, checked and delivered to a system: the borrower's ending balance, the invoice total, the policy expiration date. Accuracy per field and validation matter most. Parsing for AI search and RAG means the whole document as clean text or markdown, with tables and headings intact, split into chunks for a language model to search. Faithful layout and reading order matter most.
Tools are often built for one or the other, so decide which job you're doing first:
Which parsing job are you doing?
Document parsing tools#
The tools fall into four groups. Here's what each one does, as described in its own documentation:
| Tool | What it does |
|---|---|
| Document AI platform1 tool | |
| DocsumoOur product | Pre-trained models for business documents, validation rules, cross-document checks, a review screen and integrations, on top of OCR and parsing |
| Cloud document API3 tools | |
| Amazon Textract | Text, forms, tables, queries, and prebuilt APIs for expenses, IDs and lending documents |
| Google Document AI | OCR, Form Parser, Layout Parser and custom extractors |
| Azure AI Document Intelligence | Layout, prebuilt and custom models |
| Parser for AI and RAG3 tools | |
| Docling | Open-source toolkit that converts PDF, DOCX, HTML and other formats into one document representation for generative AI workflows |
| LlamaParse | LlamaIndex's hosted parser for turning documents into LLM-ready text |
| Unstructured | Open-source library that partitions documents into typed elements such as titles, text and tables |
| Open-source library4 tools | |
| pypdf | Reads text and metadata from digital PDFs |
| pdfplumber | Reads characters with positions, with table extraction for digital PDFs |
| PyMuPDF | Fast PDF text, image and layout extraction |
| Tesseract | Open-source OCR for scans, called from Python through pytesseract |
Docsumo's pre-trained models cover bank statements, pay stubs, tax forms, ACORD forms and invoices, among 250+ document types. See Docsumo Document AI. For Tesseract, see our Tesseract guide.
A minimal parser in Python
A minimal table read from a digital PDF with pdfplumber:
import pdfplumber
with pdfplumber.open("statement.pdf") as pdf:
for page in pdf.pages:
for table in page.extract_tables():
for row in table:
print(row)
This works on clean, digital PDFs with ruled tables. Scans, borderless tables and tables that break across pages need more work.
Document parsing use cases#
Accounts payable
Invoice headers and line items for PO matching. See AP automation.Lending
Bank statements, pay stubs and tax returns for underwriting and income verification.Insurance
ACORD forms, loss runs and certificates of insurance.Commercial real estate
Rent rolls and operating statements.Legal and procurement
Contract dates, parties, renewal terms and clauses.Healthcare
Intake forms, referrals and claim forms.Knowledge bases and AI assistants
Policies, manuals and reports parsed for search and RAG.
Build or buy?#
Build with libraries when you have a few stable, digital layouts and engineers to maintain the code. Buy a platform when you have many layouts or senders, scanned documents, tables that span pages, or values that drive decisions and need validation and an audit trail. The hidden cost of building is upkeep: every new layout and every format change is more rules.
Build with libraries
- You write rules for every layout
- Scans need an OCR step you tune yourself
- Validation, review screens and audit trails are yours to build
- Every format change is a code change
Buy a platform
- Pre-trained models handle many layouts
- OCR for scans is built in
- Validation rules, a review queue and an audit trail come with it
- Format changes are handled by the models, not your code
- 99%field-level accuracy across 250+ document types
- 95%+of documents processed straight through, without manual review
How to choose a document parser#
- Test on your own documentsInclude your worst scans and longest tables.
- Score field-level accuracy and straight-through rateNot just whether text came out.
- Check table handlingMulti-page, borderless and nested tables.
- Check validation and reviewCan you add rules and review exceptions on the source page?
- Check integrationREST API, webhooks and connectors to your systems. See integrations.
- Check securitySOC 2 Type 2, HIPAA and GDPR where your data needs them.
The bottom line#
Document parsing rebuilds structure from files that don't carry it. For a few fixed layouts, libraries and rules work. For varied business documents, use document AI with validation and review. For search and RAG, use a parser built to preserve layout as text. For the broader picture, read what is data extraction.
Book a demo to see Docsumo parse your own documents, or start a free trial.
Frequently asked questions#
What is document parsing?
Document parsing is the process of reading a document and turning its contents into structured data, such as key-value fields, tables and ordered text, that software can store, search or act on.
What is the difference between document parsing and OCR?
OCR converts an image of text into text. Parsing goes further, working out the layout and structure and which values are which fields. Parsing uses OCR as a step for scanned documents. See IDP vs OCR.
What is the best document parser?
It depends on the job. For fixed layouts, a rule-based parser is enough. For many layouts and scans, use a document AI platform with models for your document types. For turning documents into text for search or RAG, tools like Docling, LlamaParse and Unstructured are built for that.
Can I build my own document parser in Python?
Yes. Libraries like pypdf, pdfplumber and PyMuPDF read digital PDFs, and Tesseract adds OCR for scans. Expect to write and maintain rules for each layout, and to build validation and review yourself.
How accurate is AI document parsing?
It varies by tool and document. Docsumo reports 99% field-level accuracy on 250+ document types. Always test on your own documents, including poor scans.
Sources
- pdfplumber on PyPI
- pypdf on PyPI
- Docling on GitHub
- LlamaParse documentation
- Unstructured on GitHub
- AWS: Amazon Textract features
First published . Last updated .