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.
You need Docker installed. The first run downloads the image and may take longer than later runs.
Mount a folder into the container and run a subcommand:
docker run --rm -v "$(pwd)":/data -w /data pdfix/ocr-tesseract:v0.5.0 <command> [options]
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)| Option | Required | Type / expected value | Description |
|---|---|---|---|
--input, -i | yes | Path to an existing .pdf file | Input PDF |
--output, -o | yes | Path for the output .pdf file | Output PDF |
--lang | no | Tesseract language code string (e.g. eng); empty uses default handling | OCR language |
--name | no | String (PDFix account license name) | PDFix license name |
--key | no | String (PDFix account license key) | PDFix license key |
ocrUses the Common arguments.
ocr-contentUses the Common arguments, plus:
| Option | Required | Type / expected value | Description |
|---|---|---|---|
--params | yes | Path to a .json file | Object filter parameters (see 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).
OCR a scanned PDF:
docker run --rm -v "$(pwd)":/data -w /data pdfix/ocr-tesseract:v0.5.0 \
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.0 \
ocr-content --name "${LICENSE_NAME}" --key "${LICENSE_KEY}" \
-i /data/input.pdf -o /data/output.pdf --lang eng \
--params /data/params_content.json
For PDFix SDK licensing or issues, contact [email protected].
Trial versions of the PDFix SDK may apply watermarks and redact random content in the output PDF.
Content type
Image
Digest
sha256:3fa74cf00…
Size
587.5 MB
Last updated
about 1 month ago
docker pull pdfix/ocr-tesseract