HUB
Sign inSign up
ocr-tesseract logo

pdfix/ocr-tesseract

By pdfix

•Updated 11 days ago

Image
0

5.5K

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.3 <command> [options]

⁠Commands

  • ocr: OCR a PDF page-by-page and place an invisible text Form XObject per page (PDF → PDF). With --params, only filtered page content is OCR-ed.

⁠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, plus:

OptionRequiredType / expected valueDescription
--paramsnoPath to a .json fileObject filter parameters (see Params JSON⁠); without it all page content is OCR-ed

⁠Params JSON

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

Only the selected objects are rendered for OCR. When the filter selects every page object type (e.g. ".*", or a template with a single $if rule listing all types in param and no other condition), the whole page is rendered directly without enumerating page content, which is much faster on pages with a lot of content.

See 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.3 \
  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.3 \
  ocr --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:bea9a77b1…

Size

618.1 MB

Last updated

11 days ago

docker pull pdfix/ocr-tesseract