Sign inSign up

pdfix/ocr-tesseract

By pdfix

•Updated 17 days ago

Image
0

3.4K

pdfix/ocr-tesseract repository overview

⁠OCR Tesseract

A Docker image that adds an OCR text layer to PDF files using PDFix SDK and Tesseract OCR. For PDF output, a PDFix SDK license is required.

⁠Table of Contents

⁠Getting started

You need Docker installed. The first run downloads the image and may take longer than later runs.

⁠Usage

Mount a folder into the container and run a subcommand:

docker run --rm -v "$(pwd)":/data -w /data pdfix/ocr-tesseract:v0.5.2 <command> [options]

⁠Commands

  • ocr: OCR a scanned PDF page-by-page (PDF → PDF)
  • ocr-content: OCR filtered page content and place an invisible text Form XObject per page (PDF → PDF)

⁠Arguments

⁠Common
OptionRequiredType / expected valueDescription
--input, -iyesPath to an existing .pdf fileInput PDF
--output, -oyesPath for the output .pdf fileOutput PDF
--langnoTesseract language code string (e.g. eng); empty uses default handlingOCR language
--namenoString (PDFix account license name)PDFix license name
--keynoString (PDFix account license key)PDFix license key
⁠ocr

Uses the Common⁠ arguments.

⁠ocr-content

Uses the Common⁠ arguments, plus:

OptionRequiredType / expected valueDescription
--paramsyesPath to a .json fileObject filter parameters (see Params JSON⁠)

⁠Params JSON

--params is a JSON array of parameter objects with at least name and value. For ocr-content, object_types is an ECMAScript regex matching page object types (e.g. "^pds_image$", or ".*" for all), or a template object_update object.

See tests/params_content.json, tests/params_content_template.json, and example/first_page_image_content_template.json (first-page images; load into Desktop params).

⁠Examples

OCR a scanned PDF:

docker run --rm -v "$(pwd)":/data -w /data pdfix/ocr-tesseract:v0.5.2 \
  ocr --name "${LICENSE_NAME}" --key "${LICENSE_KEY}" \
  -i /data/scanned.pdf -o /data/ocr.pdf --lang eng

OCR filtered page content:

docker run --rm -v "$(pwd)":/data -w /data pdfix/ocr-tesseract:v0.5.2 \
  ocr-content --name "${LICENSE_NAME}" --key "${LICENSE_KEY}" \
  -i /data/input.pdf -o /data/output.pdf --lang eng \
  --params /data/params_content.json

⁠Help & support

For PDFix SDK licensing or issues, contact [email protected].

⁠Licenses

Trial versions of the PDFix SDK may apply watermarks and redact random content in the output PDF.

Tag summary

Content type

Image

Digest

sha256:3fa74cf00…

Size

587.5 MB

Last updated

about 2 months ago

docker pull pdfix/ocr-tesseract