Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
AI Builder
Module 7Full course11 min read

Document Understanding: Receipts, Forms, and PDFs

Read invoices, receipts, IDs, and multi-page PDFs into structured data — native PDF input vs. OCR, page-level citations, and human review for edge cases.

Documents are where vision features meet money. A refund request comes with an invoice PDF. An expense claim comes with a crumpled receipt photographed on a kitchen table. A new enterprise customer sends a signed order form and a tax exemption certificate. Somebody has to read each one and type the numbers into a system, and a single misread digit in a total turns into a wrong refund.

Models can now read all of these, including scans, photos, and multi-page PDFs, and return structured data. The hard part is making that data trustworthy. In this lesson you'll build Deskmate's billing-document reader: decide between native PDF input and text extraction, pull an invoice into a schema where every value carries page-level evidence, verify that evidence and the arithmetic in code, and route the doubtful cases to a person.

Know which kind of document you have

"Document" covers several very different inputs, and the right technique depends on which one you're holding:

KindExamplesWhat's actually in the fileMain risk
Born-digital PDFInvoices from billing systems, contracts exported from a word processorA real text layer: the characters are stored in the fileLayout: tables, columns, and headers that text extraction scrambles
Scanned PDFA signed form run through an office scannerPage images, with no text, or with a low-quality OCR layer someone else addedMisread characters, skew, stamps over text
PhotoA receipt shot on a phoneA single JPEG, often rotated, curved, or shadowedEverything above, plus glare and partial crops
Structured formTax forms, order forms, applicationsFixed fields, checkboxes, signaturesCheckbox states and handwriting

OCR (optical character recognition) is the classic technique for turning page images into text. A vision-capable language model does something broader: it reads the text and understands the layout around it, so it knows the "Total" next to "$1,240.00" belongs to the whole invoice, not to the last line item.

One category deserves a warning up front: identity documents. You can extract the name and expiry date from a photo of a driver's license, but extraction is not verification. A vision model can't reliably tell a genuine document from an edited or AI-generated one, and identity checks often carry legal obligations. Use a dedicated identity-verification provider for that job, and talk to a lawyer about your obligations.