Last Updated on January 10, 2022
OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched or copy-pasted.
OCRmyPDF analyzes each page of a PDF to determine the colorspace and resolution (DPI) needed to capture all of the information on that page without losing content. It uses Ghostscript to rasterize the page, and then performs on OCR on the rasterized image to create an OCR “layer”. The layer is then grafted back onto the original PDF. OCRmyPDF uses Tesseract for OCR, and relies on its language packs.
OCRmyPDF uses several strategies depending on input options and the input PDF itself, but generally speaking it rasterizes a page for OCR and then grafts the OCR back onto the original. As such it can handle complex PDFs and still preserve their contents as much as possible.
In addition to the required Python version (3.6+), OCRmyPDF requires external program installations of Ghostscript, Tesseract OCR, QPDF, and Leptonica. OCRmyPDF is pure Python, but uses CFFI to portably generate library bindings.
Features include:
- Generates a searchable PDF/A file from a regular PDF.
- Places OCR text accurately below the image to ease copy / paste.
- Keeps the exact resolution of the original embedded images.
- When possible, inserts OCR information as a “lossless” operation without disrupting any other content.
- Optimizes PDF images, often producing files smaller than the input file.
- If requested, deskews and/or cleans the image before performing OCR.
- Validates input and output files.
- Distributes work across all available CPU cores.
- Uses Tesseract OCR engine to recognize more than 100 languages.
- Scales properly to handle files with thousands of pages.
- Battle-tested on millions of PDFs.
- Built-in help.
- Cross-platform support – runs under Linux, macOS, FreeBSD, and Windows.
Website: github.com/ocrmypdf/OCRmyPDF
Support: Documentation
Developer: James R. Barlow and contributors
License: GNU General Public License v3.0
OCRmyPDF is written in Python. Learn Python with our recommended free books and free tutorials.
| Explore Linux | |
|---|---|
| Best Free and Open Source Software - A huge collection of recommended free and open source software covering every major category. | |
| In-depth Linux Software Reviews - Detailed assessments of Linux software covering features, usability and overall quality. | |
| The Big List of Active Linux Distros - An extensive collection of actively developed Linux distributions. | |
| Open Source Alternatives - Alternatives to software and services from Google, Microsoft, Apple, Adobe, IBM, Autodesk, Oracle and others. | |
| Essential Linux System Tools - Indispensable utilities for monitoring, maintaining and managing Linux systems. | |
| Linux Productivity Tools - Useful utilities for improving productivity and streamlining everyday tasks. | |
| Alternatives to Popular CLI Tools - Modern alternatives to familiar command-line utilities supplied with Linux systems. | |
| Awesome Free Linux Game Tools - Tools, utilities and companion software that improve gaming on Linux. | |
| Machine Learning on Linux - Machine learning and deep learning software, self-hosted applications and practical tools. | |
| Saving Money with Linux - Practical ways to reduce electricity consumption and lower computing costs with Linux. | |
| Linux Candy - Fun, entertaining and sometimes delightfully quirky software from the lighter side of Linux. | |

Please read our Comment Policy before commenting.