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:
- Current directory:
./.paddleocr_cli.yaml - Project root:
<project>/.paddleocr_cli.yaml(alongside.claude/directory) - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5de2d006100b259d6a25f2e299304ac5e1688a1f98e5d8f44d0746a78aa5041
|
|
| MD5 |
cc5097ce0443044b330cf308fc1b78ee
|
|
| BLAKE2b-256 |
7b32ef656bdd2bc8c9d4fd885f631a0437d11ffa2784a3050b6c8e4090324e4c
|
Provenance
The following attestation bundles were made for paddleocr_cli-0.2.1.tar.gz:
Publisher:
publish.yml on Explorer1092/paddleocr_cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paddleocr_cli-0.2.1.tar.gz -
Subject digest:
f5de2d006100b259d6a25f2e299304ac5e1688a1f98e5d8f44d0746a78aa5041 - Sigstore transparency entry: 810481508
- Sigstore integration time:
-
Permalink:
Explorer1092/paddleocr_cli@950f893c98fcc82536b46f2af5a3e29cbbbdc3d6 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Explorer1092
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@950f893c98fcc82536b46f2af5a3e29cbbbdc3d6 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c02c3a248b7121e82de335ae38e90967be30c07b27266e9fdfc36719bb0459a
|
|
| MD5 |
5df7b0b7fcef46443d3795b2ba0cc1ed
|
|
| BLAKE2b-256 |
da4097588cbb97e76db66f1ad205548bf52d90cf350b438a355ba08676f09815
|
Provenance
The following attestation bundles were made for paddleocr_cli-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on Explorer1092/paddleocr_cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paddleocr_cli-0.2.1-py3-none-any.whl -
Subject digest:
9c02c3a248b7121e82de335ae38e90967be30c07b27266e9fdfc36719bb0459a - Sigstore transparency entry: 810481520
- Sigstore integration time:
-
Permalink:
Explorer1092/paddleocr_cli@950f893c98fcc82536b46f2af5a3e29cbbbdc3d6 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Explorer1092
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@950f893c98fcc82536b46f2af5a3e29cbbbdc3d6 -
Trigger Event:
push
-
Statement type: