Skip to main content

A command-line tool for OCR using PaddleOCR AI Studio API

Project description

PaddleOCR CLI

A command-line tool for OCR using PaddleOCR AI Studio API.

Available in both Go (native binary) and Python versions.

Installation

Go Version (Recommended)

Download Binary

Download the latest release from GitHub Releases.

Using Homebrew (macOS/Linux)

brew install Explorer1092/tap/paddleocr-cli

Build from Source

git clone https://github.com/Explorer1092/paddleocr_cli.git
cd paddleocr_cli
go build -o paddleocr-cli ./cmd/paddleocr-cli

Python Version

Using pip

pip install paddleocr-cli

Using uv

uv pip install paddleocr-cli

Using Poetry (Development)

git clone https://github.com/Explorer1092/paddleocr_cli.git
cd paddleocr_cli
poetry install

Quick Start

1. Configure credentials

# Configure (default saves to user directory)
paddleocr-cli configure --server-url https://your-server.com --token YOUR_TOKEN

# Configure with scope
paddleocr-cli configure --server-url URL --token TOKEN -s project  # project root
paddleocr-cli configure --server-url URL --token TOKEN -s local    # current directory
paddleocr-cli configure --server-url URL --token TOKEN -s user     # ~/.config/ (default)

# Verify configuration
paddleocr-cli configure --show

# Test connection
paddleocr-cli configure --test

2. Run OCR

# Output to stdout
paddleocr-cli resume.pdf

# Output to file
paddleocr-cli resume.pdf -o output.md

# Output as JSON
paddleocr-cli resume.pdf --json

Usage

paddleocr-cli [OPTIONS] FILE

positional arguments:
  FILE                  Path to PDF or image file

options:
  -o, --output FILE     Output file path (default: stdout)
  --json                Output as JSON instead of markdown
  --page N              Extract only page N (0-indexed)
  --no-separator        Don't add page separators in markdown output
  --timeout SECONDS     Request timeout in seconds (default: 120)
  --orientation         Enable document orientation classification
  --unwarp              Enable document unwarping
  --chart               Enable chart recognition
  -q, --quiet           Suppress progress messages
  --config FILE         Path to config file

Configure subcommand

paddleocr-cli configure [OPTIONS]

options:
  --server-url URL      Set the server URL (required)
  --token TOKEN         Set the access token (required)
  -s, --scope SCOPE     Installation scope (default: user)
                        user    - ~/.config/paddleocr_cli/
                        project - project root (alongside .claude/)
                        local   - current directory
  --show                Show current configuration
  --test                Test connection to the server
  --locations           Show config file search locations

Configuration

Configuration is stored in YAML format (.paddleocr_cli.yaml). The tool searches for config files in this order:

  1. Current directory: ./.paddleocr_cli.yaml
  2. Project root: <project>/.paddleocr_cli.yaml (alongside .claude/ directory)
  3. User directory: ~/.config/paddleocr_cli/config.yaml

Config file format

paddleocr:
  server_url: "https://your-server.aistudio-app.com"
  access_token: "your_token_here"

Python API

You can also use the Python library programmatically:

from paddleocr_cli import PaddleOCRClient, Config, PaddleOCRConfig

# Use default config (from config files)
client = PaddleOCRClient()

# Or provide custom config
config = Config(
    paddleocr=PaddleOCRConfig(
        server_url="https://your-server.com",
        access_token="your_token",
    )
)
client = PaddleOCRClient(config)

# Perform OCR
result = client.ocr_file("document.pdf")

if result.success:
    print(result.full_markdown)
    for page in result.pages:
        print(f"Page {page.page_index}: {len(page.markdown)} chars")
else:
    print(f"Error: {result.error_message}")

Running Python version as a module

# Using python -m
python -m paddleocr_cli resume.pdf

# Using poetry
poetry run paddleocr-cli resume.pdf

# Using uv
uv run paddleocr-cli resume.pdf

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paddleocr_cli-0.2.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paddleocr_cli-0.2.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file paddleocr_cli-0.2.1.tar.gz.

File metadata

  • Download URL: paddleocr_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paddleocr_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f5de2d006100b259d6a25f2e299304ac5e1688a1f98e5d8f44d0746a78aa5041
MD5 cc5097ce0443044b330cf308fc1b78ee
BLAKE2b-256 7b32ef656bdd2bc8c9d4fd885f631a0437d11ffa2784a3050b6c8e4090324e4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for paddleocr_cli-0.2.1.tar.gz:

Publisher: publish.yml on Explorer1092/paddleocr_cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paddleocr_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: paddleocr_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paddleocr_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c02c3a248b7121e82de335ae38e90967be30c07b27266e9fdfc36719bb0459a
MD5 5df7b0b7fcef46443d3795b2ba0cc1ed
BLAKE2b-256 da4097588cbb97e76db66f1ad205548bf52d90cf350b438a355ba08676f09815

See more details on using hashes here.

Provenance

The following attestation bundles were made for paddleocr_cli-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Explorer1092/paddleocr_cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page