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.0.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.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paddleocr_cli-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 6b7bfe20663338b9f9a5294723f12346becd13aee0b263d06bea1acaf722ff82
MD5 9f80c258231cc1b457696c229758691b
BLAKE2b-256 d6c4fa01d3e650b2d1dc3f115ae20c969412fe6f59dcc09856e540f5d463b934

See more details on using hashes here.

Provenance

The following attestation bundles were made for paddleocr_cli-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: paddleocr_cli-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28a3c687c2a4c46c9488e3434e9b88dc39438f19fcb4001d84ea9f0728a2005a
MD5 4acfdde57e70023a13cf2b0dace738ee
BLAKE2b-256 550edac34760d62fcc8c98526a9fb267427a8e64e76666e0b7334dc436c69189

See more details on using hashes here.

Provenance

The following attestation bundles were made for paddleocr_cli-0.2.0-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