Document AI: Extracting Data from PDFs and Scanned Documents

Plants.work · · upskilling
Document AI: Extracting Data from PDFs and Scanned Documents

Turn piles of invoices and scanned documents into usable data: OCR, layout analysis and the Document AI pipeline step by step, plus where humans must check.

At every month-end, accounting staff sit typing data from tax invoices that suppliers send as scanned files. Some are crooked, some have handwriting over them, and some are PDFs you can't copy text from. This work takes a lot of time and is error-prone. Document AI is the group of technologies that turns these documents into data your systems can use.

What is Document AI?

Document AI uses AI to read, understand and extract data from documents, whether PDFs, photos or scans. It goes beyond OCR (Optical Character Recognition), which turns images of characters into text, because it also has to understand which number is the total, which text is the vendor name, and how many columns a table has.

Document AI is also the first gate of a RAG system. If documents are converted wrongly, every step after that will be wrong too. For example, a per diem rate table converted with its columns swapped will make a chatbot confidently quote figures from the wrong column.

The pipeline step by step

1. Receive and classify documents

Documents arrive by email, scanner or a photo app. The system first sorts them into invoices, receipts, contracts or forms, because each type needs different data extracted.

2. Clean up the image

Straighten the image, remove shadows, sharpen it. This looks trivial but strongly affects accuracy in the next step.

3. Read text and structure

OCR reads the characters, while layout analysis understands structure such as headers, tables, columns and reading order.

4. Extract key fields

Pull out the values you need as fields, such as vendor name, document number, date, pre-tax amount, VAT and total.

5. Validate

Apply cross-check rules: line items must add up to the total, dates must fall in a sensible range, the taxpayer ID must have a valid format. Items that fail go to a person for review.

6. Send into your systems

Validated data flows into the accounting system, ERP, or a document library for RAG.

Tools that support Thai

An example from a Thai company

A distribution company receives a large number of tax invoices from suppliers every month. It starts by using Document AI only for major suppliers that use the same form. The system extracts the data and matches it against purchase orders in the system. If they match, it proposes approval; if not, it flags the item for staff to check. Accounting staff shift from typing data to reviewing exceptions and resolving issues with suppliers.

Watch out for

Document AI doesn't replace reviewers. It lets reviewers check only what needs checking.

How to get started

  1. Pick one document type with high volume and a fairly stable form.
  2. Collect 50 to 100 real samples, including poor-quality ones.
  3. Trial 2 to 3 tools and measure accuracy field by field, not just overall.
  4. Write validation rules and define which items must go to human review.
  5. Run it in parallel with your existing process for a while before switching over fully.

If you work in accounting, read AI in accounting next, and see the course Opening up accounting work with AI-OCR on Plants.work for real-world examples.