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.

Installation

Using Poetry (Development)

git clone https://github.com/Explorer1092/paddleocr-cli.git
cd paddleocr-cli
poetry install

Using pip

pip install paddleocr-cli

Using uv

uv pip install paddleocr-cli

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    # script 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   - script 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. Script 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"

Running 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

API

You can also use the 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}")

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.1.0.tar.gz (10.2 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.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: paddleocr_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 94af01baaddf455560dc4d2442ff18bbfa3ef32e25b3e4fc7cfd018559ca1c85
MD5 e11b1c7b4588526fd67ea138cea6f9b0
BLAKE2b-256 f42ef639b25aa2da8f059c8f2c6d8539eb62f1942a2f2185510a073865506b3f

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: paddleocr_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51907af56bc2afb2eed01cafd0c5cde04fe4a68d002210c4f7b3b9d841bd2bbd
MD5 a6b0963939db4b149948df86d92c52fb
BLAKE2b-256 c84b3a64ba7ff1584fa51159f82cc64334bc75d32c2b18701918b6b886a9454f

See more details on using hashes here.

Provenance

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