{"course":{"slug":"choosing-your-tools","title":"Choosing and Using the Tools","url":"https://addaly.com/learn/choosing-your-tools","level":"beginner","track":"work"},"lesson":{"slug":"document-and-ocr-tools","title":"Documents, PDFs and OCR","url":"https://addaly.com/learn/choosing-your-tools/document-and-ocr-tools","position":62,"of":76,"minutes":8,"answer":"Check whether a PDF already has a text layer before anything else, because exact extraction beats recognition and both beat asking a vision model to read characters.","keyIdea":"Check whether a PDF already has a text layer before anything else, because exact extraction beats recognition and both beat asking a vision model to read characters, and validate extracted tables by checking whether the rows still add to the printed total."},"body":{"format":"markdown","text":"## Ask one question before choosing anything\n\n**Does this PDF already contain text, or is it a picture of a page?**\n\nEverything 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:\n\n```bash\npdftotext -layout report.pdf - | head -20\n```\n\nIf 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.\n\nPeople 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.\n\n## The free tools, in order of what you should reach for\n\n**pdftotext** (from Poppler): exact extraction from PDFs with a text layer. `-layout` preserves column structure.\n\n> Figure: Ask one question before choosing any tool. Steps: 1. Can you select and copy the text? (Or run pdftotext with the layout option and see whether words appear. Five seconds.); 2. If yes, extract it (Exact characters, no recognition step, no cost. Most PDFs produced by a computer have a text layer.); 3. If no, recognise it (Tesseract, PaddleOCR or docTR, all free. Straighten and crop the scan first: skew degrades recognition sharply.); 4. Hand the text to the model (Use the vision model for what the page means (which number is the total, what this form asks for) not for reading characters.); 5. Check that the rows add up (If the extracted rows do not reach the printed total, something was dropped. One line of arithmetic catches most table errors.). 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.\n\n**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.\n\n**PaddleOCR** and **docTR**: free, more accurate than Tesseract on messy layouts, better on non-Latin scripts, more setup.\n\n**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.\n\n**LibreOffice**: converts almost any office format to any other from the command line, free, and useful in a pipeline.\n\n```bash\nlibreoffice --headless --convert-to pdf *.docx\ntesseract scan.png out --psm 6 -l eng+hin\n```\n\n## Where a vision model is the right tool\n\nNot 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.\n\nThe 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.\n\n## Tables, which are the hard part\n\nTables 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.\n\nTwo 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.\n\n## Scanned documents and forms\n\nFor 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.\n\nFor 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.\n\n## Which format to hand the model\n\nOnce 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.\n\nFor 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.\n\n## The one to remember\n\nThe 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."},"check":{"question":"A finance team extracts invoice tables with a vision model and some totals are wrong. What check would catch this reliably and cheaply?","options":[{"text":"Re-running each extraction twice and comparing, since inconsistent results indicate the model was uncertain.","correct":false,"tempting":"Detects sampling variation rather than systematic misreading, which repeats consistently across runs."},{"text":"Raising the image resolution before sending, so small print survives the model's downsampling.","correct":false,"tempting":"Improves input quality without providing any way to detect an error that still occurs."},{"text":"Summing the extracted rows and comparing with the printed total on the document.","correct":true},{"text":"Asking the model to state its confidence for each figure it reads from the page.","correct":false,"tempting":"Requests a self-report with no grounding, since the model cannot distinguish a digit it read from one it reconstructed."}]},"prev":{"slug":"research-and-search-tools","title":"Research and search tools","url":"https://addaly.com/learn/choosing-your-tools/research-and-search-tools"},"next":{"slug":"spreadsheet-and-data-tools","title":"Spreadsheets and data tools","url":"https://addaly.com/learn/choosing-your-tools/spreadsheet-and-data-tools"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Exam keys checked blind by a second model: 3,665 of 3,666 agreed. Academic review invited.","review":{"status":"Draft, open for academic review"},"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).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Documents, PDFs and OCR","courseTitle":"Choosing and Using the Tools","module":{"index":7,"slug":"beyond-chat","title":"Beyond the chat box"},"answer":null,"keyIdea":"Check whether a PDF already has a text layer before anything else, because exact extraction beats recognition and both beat asking a vision model to read characters, and validate extracted tables by checking whether the rows still add to the printed total.","hero":{"kind":"figure","figure":{"t":"figure","label":"Figure","figure":{"type":"flow","steps":[{"label":"Can you select and copy the text?","detail":"Or run pdftotext with the layout option and see whether words appear. Five seconds."},{"label":"If yes, extract it","detail":"Exact characters, no recognition step, no cost. Most PDFs produced by a computer have a text layer."},{"label":"If no, recognise it","detail":"Tesseract, PaddleOCR or docTR, all free. Straighten and crop the scan first: skew degrades recognition sharply."},{"label":"Hand the text to the model","detail":"Use the vision model for what the page means (which number is the total, what this form asks for) not for reading characters."},{"label":"Check that the rows add up","detail":"If the extracted rows do not reach the printed total, something was dropped. One line of arithmetic catches most table errors."}],"title":"Ask one question before choosing any tool","caption":"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."},"alt":"Figure: Ask one question before choosing any tool. Steps: 1. Can you select and copy the text? (Or run pdftotext with the layout option and see whether words appear. Five seconds.); 2. If yes, extract it (Exact characters, no recognition step, no cost. Most PDFs produced by a computer have a text layer.); 3. If no, recognise it (Tesseract, PaddleOCR or docTR, all free. Straighten and crop the scan first: skew degrades recognition sharply.); 4. Hand the text to the model (Use the vision model for what the page means (which number is the total, what this form asks for) not for reading characters.); 5. Check that the rows add up (If the extracted rows do not reach the printed total, something was dropped. One line of arithmetic catches most table errors.). 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."}},"blocks":[{"t":"h2","id":"ask-one-question-before-choosing-anything","runs":[{"text":"Ask one question before choosing anything"}]},{"t":"p","runs":[{"text":"Does this PDF already contain text, or is it a picture of a page?","b":true}]},{"t":"p","runs":[{"text":"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:"}]},{"t":"code","lang":"bash","label":"Bash","text":"pdftotext -layout report.pdf - | head -20"},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"the-free-tools-in-order-of-what-you-should-reach-for","runs":[{"text":"The free tools, in order of what you should reach for"}]},{"t":"p","runs":[{"text":"pdftotext","b":true},{"text":" (from Poppler): exact extraction from PDFs with a text layer. "},{"text":"-layout","code":true},{"text":" preserves column structure."}]},{"t":"p","runs":[{"text":"Tesseract","b":true},{"text":": the long-standing free OCR engine. Good on clean printed pages, weaker on complex layouts, supports over 100 languages including Indic and Arabic scripts."}]},{"t":"p","runs":[{"text":"PaddleOCR","b":true},{"text":" and "},{"text":"docTR","b":true},{"text":": free, more accurate than Tesseract on messy layouts, better on non-Latin scripts, more setup."}]},{"t":"p","runs":[{"text":"Docling","b":true},{"text":" 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."}]},{"t":"p","runs":[{"text":"LibreOffice","b":true},{"text":": converts almost any office format to any other from the command line, free, and useful in a pipeline."}]},{"t":"code","lang":"bash","label":"Bash","text":"libreoffice --headless --convert-to pdf *.docx\ntesseract scan.png out --psm 6 -l eng+hin"},{"t":"h2","id":"where-a-vision-model-is-the-right-tool","runs":[{"text":"Where a vision model is the right tool"}]},{"t":"p","runs":[{"text":"Not for exact characters. For "},{"text":"layout and meaning","b":true},{"text":": 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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"tables-which-are-the-hard-part","runs":[{"text":"Tables, which are the hard part"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"scanned-documents-and-forms","runs":[{"text":"Scanned documents and forms"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"which-format-to-hand-the-model","runs":[{"text":"Which format to hand the model"}]},{"t":"p","runs":[{"text":"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."}]},{"t":"p","runs":[{"text":"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."}]},{"t":"h2","id":"the-one-to-remember","runs":[{"text":"The one to remember"}]},{"t":"p","runs":[{"text":"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."}]}],"check":{"question":[{"text":"A finance team extracts invoice tables with a vision model and some totals are wrong. What check would catch this reliably and cheaply?"}],"options":[{"text":[{"text":"Re-running each extraction twice and comparing, since inconsistent results indicate the model was uncertain."}],"correct":false,"tempting":[{"text":"Detects sampling variation rather than systematic misreading, which repeats consistently across runs."}]},{"text":[{"text":"Raising the image resolution before sending, so small print survives the model’s downsampling."}],"correct":false,"tempting":[{"text":"Improves input quality without providing any way to detect an error that still occurs."}]},{"text":[{"text":"Summing the extracted rows and comparing with the printed total on the document."}],"correct":true,"tempting":null},{"text":[{"text":"Asking the model to state its confidence for each figure it reads from the page."}],"correct":false,"tempting":[{"text":"Requests a self-report with no grounding, since the model cannot distinguish a digit it read from one it reconstructed."}]}],"order":[1,0,3,2],"why":null},"prev":{"slug":"research-and-search-tools","title":"Research and search tools","minutes":9},"next":{"slug":"spreadsheet-and-data-tools","title":"Spreadsheets and data tools","minutes":8}}}