中文

OCRmyPDF

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched or copy-pasted.

Verified

Core facts

Read by a script from the official API, not rewritten by a model.

License
MPL-2.0
Languages
Python
Maintainer
ocrmypdf
Verified

What it is

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched or copy-pasted. OCRmyPDF uses Tesseract for OCR and relies on its language packs. OCRmyPDF is pure Python and runs on Linux, macOS, Windows and FreeBSD. OCRmyPDF provides a plugin interface that allows its capabilities to be extended or replaced.

Main features

  1. OCRmyPDF keeps the exact resolution of the original embedded images.

  2. When possible, OCRmyPDF inserts OCR information as a "lossless" operation without disrupting any other content.

  3. If requested, OCRmyPDF deskews and/or cleans the image before performing OCR.

  4. OCRmyPDF validates input and output files.

Getting started

  1. OCRmyPDF supports Linux, Windows, macOS and FreeBSD.

  2. Docker images are also available, for both x64 and ARM.

  3. For Linux users, packages that provide language packs can often be found.

  4. Multiple languages can be requested in OCRmyPDF.

  5. Once OCRmyPDF is installed, its built-in help, which explains the command syntax and options, can be accessed.

From the README · bash
ocrmypdf                      # it's a scriptable command line program
   -l eng+fra                 # it supports multiple languages
   --rotate-pages             # it can fix pages that are misrotated
   --deskew                   # it can deskew crooked PDFs!
   --title "My PDF"           # it can change output metadata
   --jobs 4                   # it uses multiple cores by default
   --output-type pdfa         # it produces PDF/A by default
   input_scanned.pdf          # takes PDF input (or images)
   output_searchable.pdf      # produces validated PDF output
From the README · bash

# Debian/Ubuntu users
apt-cache search tesseract-ocr # Display a list of all Tesseract language packs
apt-get install tesseract-ocr-chi-sim  # Example: Install Chinese Simplified language pack

# Arch Linux users
pacman -S tesseract-data-eng tesseract-data-deu # Example: Install the English and German language packs

# OpenBSD users
pkg_info -aQ tesseract  # Display a list of all Tesseract language packs
pkg_add tesseract-cym  # Example: Install the Welsh language pack

# brew macOS users
brew install tesseract-lang

# Fedora users
dnf search tesseract-langpack # Display a list of all Tesseract language packs 
dnf install tesseract-langpack-ita # Example: Install the Italian language pack
From the README · bash
ocrmypdf --help

Who it is for

OCRmyPDF distributes work across all available CPU cores. The project's own feature list says it scales properly to handle files with thousands of pages. The project's own feature list says it is battle-tested on millions of PDFs.

The project's own feature list says it keeps your private data private. OCRmyPDF supports Tesseract 4.1.1+, meaning version 4.1.1 or higher. In addition to the required Python version, OCRmyPDF requires external installations of Ghostscript and Tesseract OCR.

The OCRmyPDF-AppleOCR plugin replaces the standard Tesseract OCR engine with Apple Vision Framework. The OCRmyPDF-EasyOCR plugin replaces the standard Tesseract OCR engine with EasyOCR, a newer OCR engine based on PyTorch. The OCRmyPDF-EasyOCR plugin states that a GPU is strongly recommended.

paperless-ngx provides integration of OCRmyPDF into a searchable document management system. The OCRmyPDF software is licensed under the Mozilla Public License 2.0 (MPL-2.0). Generally speaking, non-core code is licensed under MIT, and the documentation and test files are licensed under Creative Commons ShareAlike 4.0 (CC-BY-SA 4.0).

Some components of OCRmyPDF have other licenses, as indicated by standard SPDX license identifiers or the DEP5 copyright and licensing information file.

Sources

This page is written from the official sources below. Open them to check the original text.

Verified ·

This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.