Skip to content

OCR and document export ​

The CLI offers two OCR workflows: read text and coordinates from one image, or export an ordered image set as documents. Prepare clear local images and complete authorization first. Scan and enhancement results can both be inputs. Whether OCR needs a network depends on the selected processing service; see privacy and security.

Extract text from one image ​

bash
czur-open ocr extract-text "./scans/page-1.jpg"
czur-open ocr extract-text "./scans/page-1.jpg" --json

By default, plain text goes to stdout and diagnostics to stderr, ready for downstream programs. --json returns status: "succeeded", text, recognized, optional image width / height, and blocks.

Each block contains text, x, y, width, height, and optional confidence and font_size. Coordinates refer to the image submitted for recognition. If you crop or rotate first, use the processed image's coordinate space rather than mapping directly to the original. Full text is joined in Runtime block order, without additional sorting.

Blank images or empty blocks can be valid recognition results, not invocation failures. Inspect recognized and text to determine whether content was found. This command accepts one image, not export options such as --format, --output-dir, or --params. Do not invent unpublished engine or language parameters.

Export ordered images as documents ​

bash
czur-open ocr recognize "./scans/page-1.jpg" "./scans/page-2.jpg" --format pdf --export-type multi-page --output-dir "./documents" --task-timeout 600000 --json

Images are submitted in command-line order, not directory enumeration or filename order. multi-page combines images into a multipage document; single-page exports them individually. One capture can return multiple images; preserve all returned images and their order when passing inputs.

Defaults are docx, multi-page, and output directory ~/Documents/CZUR Open. Specifying format and export type explicitly makes automation intent clearer.

--formatIntended result
txtPlain-text document
pdfOCR PDF for reading, searching, and sharing
docxText document for subsequent editing
xlsxSpreadsheet output for tabular material
ofdOFD document output
jsonStructured OCR document file, not the CLI stdout mode switch

For example, export one Word document per image:

bash
czur-open ocr recognize "./scans/page-1.jpg" "./scans/page-2.jpg" --format docx --export-type single-page --output-dir "./documents" --json

Actual format availability depends on the processing service response. An unsupported format returns an error without automatic fallback. Layout and table reconstruction depend on input quality and the service; review important materials manually.

Extended parameter files ​

To configure official OCR parameters, prepare a JSON object according to your service's parameter documentation and pass it with --params. Omit the option when no extra parameters are needed. A minimal valid object is:

json
{}

Save it as ocr-params.json, then run:

bash
czur-open ocr recognize "./scans/page-1.jpg" --format pdf --params "./ocr-params.json" --output-dir "./documents" --json

The file must contain an object, not an array or JSON string. Do not compress recognition inputs merely to reduce exported file size: export quality and recognition inputs are separate concerns. Retain clear images and configure output quality only through officially declared params, without guessing field names or defaults.

Waiting, cancellation, and delivery ​

ocr recognize uploads, submits, polls for a terminal state, and downloads managed outputs within the same command and connection. The default overall task wait is 300000 milliseconds (5 minutes), configurable with --task-timeout. --timeout controls individual requests, not the overall task deadline. Both extraction and export support --command-url, --asset-url, --ca-file, and --timeout for connections.

Successful exports return status, task_id, files, progress, format, and export_type. Each file includes local path, file_uri, content_type, and size. Read actual delivered paths rather than using service temporary paths. Downloads do not overwrite existing files. Missing outputs or failed downloads must not be treated as success.

The CLI does not provide detached background OCR tasks or cross-process query/recovery. Ctrl+C, termination signals, or timeouts only attempt officially supported cancellation and cannot guarantee immediate computation termination. After failures, disconnections, or delivery errors, inspect diagnostics and existing files before deciding to retry, avoiding duplicate submissions.

Review exported documents ​

Open an exported PDF and search/copy sample text, checking page order and content. A file's existence or extension alone does not prove searchable text. Open other formats in appropriate readers/editors to verify content, pagination, tables, and order. PDF / OFD / TIFF files produced by enhancement alone do not automatically have an OCR text layer.

For sensitive documents, confirm data flows through processing services and downstream AI applications first. For a scan-to-OCR script, use returned image paths as shown in JSON output and automation, without guessing filenames. See Command Reference for all options.