---
title: "ezgh ocr process"
description: "Read the text in a document (PDF, PNG, JPEG, TIFF, WebP) with a processor."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ezgh ocr process

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh ocr process <file|-> --processor <processor> [--pages 1-3] [-o text|json|yaml] [--out file] [--strict] [flags]
```

Process a document online: up to 10 MiB and 5 pages, answered within a minute. "-" reads the document from stdin. Its type comes from its content. ezgh waits up to 2 minutes for the answer (the upload and the processing), unless `--timeout` says otherwise.

The text of each page that succeeded is printed (with a "--- page N ---" line before each when there's more than one); -o json prints the API's answer as it came, -o yaml the same as YAML. `--out` writes the output to a file (readable only by you) instead of stdout.

A page can fail while others succeed (it timed out, or the model ran out of room): its error goes to stderr, the command still exits 0, and only the pages that succeeded are billed. `--strict` makes any failed page exit 1.

Processing isn't idempotent: every request runs the model again and is billed again. So ezgh only retries when the service says it had no capacity to start (503 capacity_unavailable, after its Retry-After), never after an answer or a request that got none. A quota refusal exits 6.

Part of [`ezgh ocr`](/cli/reference/ocr).

## Examples

```sh
ezgh ocr process receipt.jpg --processor receipts
ezgh ocr process scan.pdf --processor forms --pages 1-2 -o json --out scan.json
curl -s https://example.com/form.pdf | ezgh ocr process - --processor forms
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--out` | string |  | write the output to this file instead of stdout |
| `--pages` | string |  | only these pages, e.g. 1-3,5 (default: every page) |
| `--processor` | string |  | the processor, by ID, slug or name (required) |
| `--strict` | boolean |  | exit 1 if any page failed |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/ocr-process/index.mdx
