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.3 <command> [options]
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.| 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, plus:
| Option | Required | Type / expected value | Description |
|---|---|---|---|
--params | no | Path to a .json file | Object filter parameters (see Params JSON); without it all page content is OCR-ed |
--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).
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
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:bea9a77b1…
Size
618.1 MB
Last updated
11 days ago
docker pull pdfix/ocr-tesseract