skillfed

ocrmypdf

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched

ocrmypdf v17.10.0 1.2M downloads/30d#4,272 on PyPI34,446
Copyleft license MPL-2.0 Active released

What it is and what it does

OCRmyPDF is a command-line tool that takes scanned PDFs or images and adds an invisible searchable text layer using Tesseract OCR, making the content copy-pasteable and indexable. It preserves the original image resolution, optionally deskews crooked pages, cleans images before OCR, and can convert output to PDF/A format for long-term archival. The tool validates both input and output, distributes work across available CPU cores, and supports over 100 languages through Tesseract's language packs.

The package wraps Tesseract OCR and Ghostscript into a Python interface with 13 runtime dependencies including pikepdf for PDF manipulation, pillow for image handling, pydantic for configuration, and rich for CLI output. It runs on Linux, macOS, Windows, and FreeBSD. The tool is designed for batch processing and scales to handle files with thousands of pages; it keeps processed data private and does not require network access.

Use it for:

  • Digitize paper documents or scanned PDFs to make them searchable and copy-pasteable for archival or document management systems.
  • Batch convert image files (JPG, PNG) to single-page searchable PDFs for integration into document workflows.
  • Prepare scanned documents for long-term storage by converting to PDF/A format with embedded OCR text.
  • Straighten and clean crooked or low-quality scans before OCR to improve recognition accuracy.
  • Process multilingual documents by specifying multiple language codes (e.g., eng+fra) to recognize mixed-language content.
  • Optimize PDF file sizes while adding OCR, reducing storage overhead for large document collections.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

OCRmyPDF adds searchable text layers to scanned PDF files using Tesseract OCR, enabling them to be searched and copy-pasted while optionally deskewing, cleaning, and converting to PDF/A format.

Yes. OCRmyPDF is actively maintained, widely used (top 5000 PyPI packages, 1.17M monthly downloads), has no known vulnerabilities, and solves a specific, well-defined problem. Low install friction and copyleft licensing pose no barrier for most users. The main prerequisite—external system binaries (Tesseract, Ghostscript)—is clearly documented and available across major platforms. Install it if you need to make scanned PDFs searchable.

Install

ocrmypdf on PyPI

pip

pip install ocrmypdf

uv

uv add ocrmypdf

poetry

poetry add ocrmypdf

Installing ocrmypdf

Before you install

Low friction: pure Python wheel with 13 runtime dependencies. Active maintenance—last release 9 days ago, repository at 34446 stars with recent commits. Requires external system binaries (Tesseract OCR and Ghostscript) to function.

License in practice

MPL-2.0 (copyleft): you may use and modify the package freely, but any modifications you distribute must be released under the same license. Suitable for most commercial and open-source projects, though distribution of modified versions carries obligations.

Quickstart

pip install ocrmypdf

ocrmypdf -l eng input_scanned.pdf output_searchable.pdf

Requires Tesseract OCR and Ghostscript to be installed and available on PATH; Python >=3.11 required.

Verify before relying

  • Performance characteristics on large multi-page documents (fact sheet mentions thousands of pages but provides no benchmarks).
  • Actual file size reduction from image optimization (description claims files often smaller than input but no metrics given).
  • Accuracy of OCR output across the 100+ supported languages (language support confirmed but quality variance unknown).

Package facts

License MPL-2.0 (copyleft)
Python support supports the current Python release (>=3.11)
Install friction low — pure-Python wheel
Runtime dependencies 13 — fpdf2, img2pdf, packaging, pdfminer-six, pi-heif, pikepdf, pillow, pluggy, pydantic, pypdfium2, rich, typing-extensions, uharfbuzz
Maintenance actively maintained — 9 days since the last release
Last repo commit
First released
Downloads 1,169,727/month — #4,272 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ocrmypdf-17.10.0-py3-none-any.whl

Keywords: OCR, PDF, PDF/A, optical character recognition, scanning

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: End Users/DesktopIntended Audience :: Science/ResearchIntended Audience :: System AdministratorsOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: POSIX :: BSDOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Image RecognitionTopic :: Text Processing :: IndexingTopic :: Text Processing :: Linguistic

Tags

add OCR text layer to PDFmake scanned PDF searchabletesseract OCR wrapperPDF text recognitionconvert image to searchable PDFdeskew and OCR PDFPDF/A conversion tool
ocrpdf-processingdocument-digitization

More Linguistic packages