How To OCR A PDF
First check whether it needs OCR at all — then pick the tool that matches the stakes.
How to OCR a PDF starts with a question most guides skip: does the PDF need OCR at all? Born-digital PDFs carry a text layer — extractable directly, losslessly, with any PDF library — and running OCR on them replaces perfect text with a model's approximation. Check first (select text in a viewer, or programmatically test for extractable text per page); OCR is for the pages that are images: scans, faxes, photographs bound into PDF. Mixed files are common, so the robust recipe operates per page — extract the text layer where it exists, recognize where it doesn't.
The tool ladder matches effort to stakes. Quickest: OCRmyPDF, the command-line standard — ocrmypdf input.pdf output.pdf adds a searchable text layer under the original page images (Tesseract underneath), with flags for language packs, deskewing, and cleanup: ideal for making archives searchable. Programmatic: Python with pypdfium2 or pdf2image to rasterize pages, then an OCR engine — Tesseract via pytesseract for the classical route, EasyOCR or PaddleOCR for deep-learning robustness, or a document parser like Docling when you want structure (tables, layout, markdown) rather than raw text. Managed: cloud document APIs (Google Document AI, Amazon Textract, Azure Document Intelligence) for accuracy and structure without hosting models — minding per-page cost and the fact that your documents leave for the provider's cloud, which sensitive content may prohibit. For the hardest material — handwriting, degraded scans, complex layouts — vision-language models now read what dedicated engines miss, locally via open weights or through APIs.
Whatever the tool, verify: spot-check output against pages (especially tables and numbers), watch per-word confidence where the engine reports it, and match preprocessing to the input (300 DPI rasterization is the workhorse setting; deskew and denoise for rough scans). And if the PDFs are one step in something larger — extraction, search, RAG — choose from the start a tool whose output preserves what the pipeline downstream needs: positions, structure, and confidence, not just characters.
The text layer is data, not narrative — reconstructing paragraphs from positioned glyphs.
The engine that's been open-sourcing OCR since before it was fashionable — still a defensible default for clean text.
From 'how do I OCR a PDF' to production pipelines — the learning path through document intelligence.
Proof Perimeter runs document AI inside your own perimeter — with a provenance record on every field.
Book a demo