PaddleOCR Document Parsing V2
by @hiotec
Parse documents using PaddleOCR's API. Supports both sync and async modes for images and PDFs.
clawhub install paddleocr-doc-parsing-v2π About This Skill
name: paddleocr-doc-parsing description: Parse documents using PaddleOCR's API. Supports both sync and async modes for images and PDFs. homepage: https://www.paddleocr.com metadata: { "openclaw": { "emoji": "π", "os": ["darwin", "linux"], "requires": { "bins": ["curl", "base64", "jq", "python3"], "env": ["PADDLEOCR_ACCESS_TOKEN", "PADDLEOCR_API_URL"], }, }, }
PaddleOCR Document Parsing
Parse images and PDF files using PaddleOCR's API. Supports both synchronous and asynchronous parsing modes with structured output.
Resource Links
| Resource | Link | | --------------------- | ------------------------------------------------------------------------------ | | Official Website | https://www.paddleocr.com | | API Documentation | https://ai.baidu.com/ai-doc/AISTUDIO/Cmkz2m0ma | | GitHub | https://github.com/PaddlePaddle/PaddleOCR |
Key Features
Setup
1. Visit PaddleOCR to obtain your API credentials 2. Set environment variables:
export PADDLEOCR_ACCESS_TOKEN="your_token_here"
export PADDLEOCR_API_URL="https://your-endpoint.aistudio-app.com/layout-parsing"Optional: For async mode
export PADDLEOCR_JOB_URL="https://your-job-endpoint.aistudio-app.com/api/v2/ocr/jobs"
export PADDLEOCR_MODEL="PaddleOCR-VL-1.5"
Usage Examples
Sync Mode (Default)
For small files and quick processing:
# Parse local image
{baseDir}/paddleocr_parse.sh document.jpgParse PDF
{baseDir}/paddleocr_parse.sh -t pdf document.pdfParse from URL
{baseDir}/paddleocr_parse.sh https://example.com/document.jpgSave output to file
{baseDir}/paddleocr_parse.sh -o result.json document.jpgVerbose output
{baseDir}/paddleocr_parse.sh -v document.jpg
Async Mode
For large files with progress tracking:
# Parse large PDF with async mode
{baseDir}/paddleocr_parse.sh --async large-document.pdfParse from URL with async mode
{baseDir}/paddleocr_parse.sh --async -t pdf https://example.com/doc.pdfSave async result to file
{baseDir}/paddleocr_parse.sh --async -o result.json document.pdf
Using Python Script Directly
# Sync mode
python3 {baseDir}/paddleocr_parse.py document.jpgAsync mode
python3 {baseDir}/paddleocr_parse.py --async-mode document.pdfWith output file
python3 {baseDir}/paddleocr_parse.py -o result.json --async-mode document.pdf
Response Structure
{
"logId": "unique_request_id",
"errorCode": 0,
"errorMsg": "Success",
"result": {
"layoutParsingResults": [
{
"prunedResult": [...],
"markdown": {
"text": "# Document Title\n\nParagraph content...",
"images": {}
},
"outputImages": [...],
"inputImage": "http://input-image"
}
],
"dataInfo": {...}
}
}
Important Fields:
prunedResult - Contains detailed layout element information including positions, categories, etc.markdown - Stores the document content converted to Markdown format with preserved structure and formatting.Mode Selection Guide
| Use Case | Recommended Mode | |----------|-----------------| | Small images (< 10MB) | Sync | | Single page PDFs | Sync | | Large PDFs (> 10MB) | Async | | Multi-page documents | Async | | Batch processing | Async | | Quick text extraction | Sync |
Error Handling
The script will exit with code 1 and print error message for:
Quota Information
See official documentation: https://ai.baidu.com/ai-doc/AISTUDIO/Xmjclapam
βοΈ Configuration
1. Visit PaddleOCR to obtain your API credentials 2. Set environment variables:
export PADDLEOCR_ACCESS_TOKEN="your_token_here"
export PADDLEOCR_API_URL="https://your-endpoint.aistudio-app.com/layout-parsing"Optional: For async mode
export PADDLEOCR_JOB_URL="https://your-job-endpoint.aistudio-app.com/api/v2/ocr/jobs"
export PADDLEOCR_MODEL="PaddleOCR-VL-1.5"