Choosing and Using the ToolsLesson 62 of 76

Contents

Choosing and Using the Tools

Lesson 62 of 76. Sign in to keep your place.

Module 7 · Beyond the chat box

Documents, PDFs and OCR

8 min read

Ask one question before choosing any toolCan you selectand copy thetext?Or run pdftotextwith the layoutoption and seewhether wordsappear. Fiveseconds.If yes, extractitExactcharacters, norecognitionstep, no cost.Most PDFsproduced by acomputer have atext layer.If no,recognise itTesseract,PaddleOCR ordocTR, all free.Straighten andcrop the scanfirst: skewdegradesrecognitionsharply.Hand the textto the modelUse the visionmodel for whatthe page means(which number isthe total, whatthis form asksfor) not forreadingcharacters.Check that therows add upIf the extractedrows do notreach theprinted total,something wasdropped. Oneline ofarithmeticcatches mosttable errors.People routinely send a text-layer PDF through a vision model, pay for it, wait for it, and receive aversion with one digit changed. The exact characters were sitting in the file the whole time.
People routinely send a text-layer PDF through a vision model, pay for it, wait for it, and receive a version with one digit changed. The exact characters were sitting in the file the whole time.

Figure

Ask one question before choosing anything

Does this PDF already contain text, or is it a picture of a page?

Everything follows from the answer, and it takes five seconds to find out. If you can select and copy text in a PDF viewer, the text is there. Or:

Bash
pdftotext -layout report.pdf - | head -20

If that prints words, the text layer exists and extraction is exact. If it prints nothing, the file is images and you need recognition, which is approximate.

People routinely send a text-layer PDF through a vision model, pay for it, wait for it, and receive a version with one digit changed. The text was sitting there.

The free tools, in order of what you should reach for

pdftotext (from Poppler): exact extraction from PDFs with a text layer. -layout preserves column structure.

Tesseract: the long-standing free OCR engine. Good on clean printed pages, weaker on complex layouts, supports over 100 languages including Indic and Arabic scripts.

PaddleOCR and docTR: free, more accurate than Tesseract on messy layouts, better on non-Latin scripts, more setup.

Docling and similar document-conversion tools: free libraries that turn PDFs into structured Markdown, preserving headings and tables, which is exactly the shape a model reads best.

LibreOffice: converts almost any office format to any other from the command line, free, and useful in a pipeline.

Bash
libreoffice --headless --convert-to pdf *.docx
tesseract scan.png out --psm 6 -l eng+hin

Where a vision model is the right tool

Not for exact characters. For layout and meaning: which of these is the invoice total, what does this form ask for, what is this diagram showing, is this table structured by row or by column. A vision model reading a page it can see, alongside text you extracted exactly, is a strong combination.

The general shape for a document pipeline: extract text with the exact tool, use the model to interpret, and check any number that matters against the source.

Tables, which are the hard part

Tables are where document extraction fails most often, in both routes. A table split across a page break, or with merged cells, or with a header repeated halfway down, confuses text extraction and vision models alike.

Two practical measures. Ask for the output in a structured form you can validate (a list of rows with named fields) so a missing column is visible rather than silently absorbed. And check the totals: if the extracted rows do not add up to the printed total, something was dropped, and this single check catches most table extraction errors in one line of arithmetic.

Scanned documents and forms

For a stack of scanned forms, the reliable approach is dull and works. Straighten and crop the images first: free tools do this, and a skewed scan degrades recognition sharply. Recognise the text. Then have a model pull named fields from the recognised text rather than from the image.

For handwriting, expect variable results and check everything. Neat printing is often fine; joined-up writing, faint pencil, and forms filled in by many different people are not. There is no tool that solves this reliably today, and a product claiming otherwise should be tested on your worst example rather than your best one.

Which format to hand the model

Once you have the text, the format you send it in changes the answers. Markdown with headings preserved is markedly better than a wall of undifferentiated text, because the structure tells the model what is a section, a heading and a list. This is why the document-conversion tools that emit Markdown are worth the extra step.

For long documents, keep the page or section numbers in the text as you extract, so that when you ask for a quotation the model can give you a location you can check. A citation you cannot verify is worth much less than one you can, and putting the numbers in costs nothing at extraction time and is impossible to add afterwards.

The one to remember

The cheapest, fastest and most accurate route through a document is almost always the least fashionable one: use the text that is already in the file. Reach for recognition when there is no text, and for a vision model when the question is about what the page means rather than what it says.

Every lesson here is open. Your progress is recorded once you pass the AI at Work exam.

Check your understanding

A finance team extracts invoice tables with a vision model and some totals are wrong. What check would catch this reliably and cheaply?

Pick the one you would defend. Your answer stays private.

Next lesson · 8 minSpreadsheets and data tools

Stuck on something?Ask Rukmini, your AI tutor

How to cite: Addaly (2026) ‘Documents, PDFs and OCR’, in Choosing and Using the Tools. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/choosing-your-tools/document-and-ocr-tools (Accessed: 13 October 2026).