Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsJul 13, 2026·2 min de lectura

OCRmyPDF — Add Searchable Text Layers to Scanned PDFs

Adds an accurate OCR text layer to scanned PDF files so they become searchable, copy-pasteable, and accessible, while preserving the original scan quality.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
OCRmyPDF Overview
Comando de instalación directa
npx -y tokrepo@latest install 4d40ca36-7eb7-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

OCRmyPDF takes a scanned PDF (image-only) and produces a PDF/A output that contains a hidden text layer under each page image. The text layer is generated by Tesseract OCR and positioned to match the visual layout, making the file fully searchable while keeping the original scan intact.

What OCRmyPDF Does

  • Adds an invisible OCR text layer to scanned PDFs without degrading image quality
  • Produces PDF/A-compliant archival output by default
  • Skips pages that already contain text to avoid double-processing
  • Automatically deskews, cleans, and rotates pages before OCR
  • Supports batch processing of entire directories

Architecture Overview

OCRmyPDF orchestrates a pipeline of external tools: Ghostscript for PDF rendering, unpaper for image cleaning, Tesseract for OCR, and pikepdf for reassembling the final PDF. Each page is processed in parallel. The text layer is positioned using hOCR coordinate data so that selecting text in a viewer highlights the correct region.

Self-Hosting & Configuration

  • Install via pip, conda, or your distro's package manager (apt, brew, etc.)
  • Tesseract and Ghostscript must be available on the system PATH
  • Install extra Tesseract language packs for non-English documents
  • Use --output-type pdfa (default) for archival; --output-type pdf to skip PDF/A conversion
  • Run inside Docker with jbarlow83/ocrmypdf for an isolated environment

Key Features

  • Lossless by default: the original scanned images are not re-encoded
  • Produces PDF/A for long-term archival compliance
  • Multithreaded page processing for fast throughput on multi-core machines
  • Plugin system for custom pre-processing or alternative OCR engines
  • Handles mixed documents (pages with and without existing text)

Comparison with Similar Tools

  • Tesseract CLI — raw OCR to plain text; OCRmyPDF wraps it into a full PDF pipeline
  • Adobe Acrobat — commercial; OCRmyPDF is free and scriptable
  • pdfsandwich — similar concept but fewer configuration options and slower development
  • Paperless-ngx — document management system that uses OCRmyPDF internally

FAQ

Q: Does it reduce scan quality? A: No. By default OCRmyPDF copies the original images without re-encoding.

Q: Which languages are supported? A: Any language Tesseract supports, currently over 100.

Q: Can it process thousands of files? A: Yes. Use a shell loop or GNU parallel; each invocation is self-contained.

Q: Does it work on born-digital PDFs? A: It detects existing text layers and skips those pages unless forced.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados