OCRmyPDF adds a searchable text layer under scanned PDF images using Tesseract, keeping layout friendly for copy and paste while optimizing file size.
Overview
OCRmyPDF addresses scanned PDFs that are hard to search or edit by running optical character recognition and embedding recognized text beneath the original images. The goal is accurate text placement for selection, preserved image resolution, and lossless updates when possible.
The tool can deskew or clean pages before OCR, validate inputs and outputs, spread work across CPU cores, and handle large documents with thousands of pages. Optional steps optimize images and may shrink files compared with the source. It relies on external Ghostscript and Tesseract installations alongside Python.
Language packs come from Tesseract; the -l flag hints recognition languages. Packages exist for major Linux distributions, macOS via Homebrew or MacPorts, Windows including WSL, FreeBSD, and Snap, plus Docker images for x64 and ARM. A plugin interface allows extensions, and an API supports embedding in other systems such as document managers.
Paperless-ngx integrates OCRmyPDF into document workflows. The project also documents batch directories, watched folders, and deployment patterns for automated processing pipelines.
Key features
- Searchable text under original page images
- Preserves embedded image resolution
- Optional deskew and image cleanup
- Multi-core parallel processing
- PDF and PDF/A output support
- Tesseract language pack integration
- Input and output validation
- Plugin and Python API extension points
Use cases
- Making scanned archives searchable
- Preparing PDFs for copy-paste access
- Batch OCR in document management
- Automating OCR in CI or hot folders
- Long-term archival PDF/A generation