百度官方 OCR 文档解析引擎
简介
百度官方 PaddleOCR 驱动,支持 110+ 语言的文档解析技能,精准提取 PDF/图片中的结构化文本与表格布局。
原始描述
Parse documents using PaddleOCR's API.
通过你的 Agent 添加
安装目录:paddleocr-doc-parsing/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
PaddleOCR Document Parsing 是一个基于百度PaddlePaddle开源项目的文档解析Skill,通过调用PaddleOCR API实现图像和PDF文件的智能OCR识别。支持两种工作模式:
- 同步模式:适用于小文件(<10MB)和单页PDF,响应快速,默认600秒超时
- 异步模式:适用于大文件和多页文档,支持进度轮询,适合批量处理场景
用户通过Shell脚本或Python脚本直接调用,支持本地文件、URL输入,输出为包含Markdown格式文本、布局分析结果的JSON结构。使用前需配置PADDLEOCR_ACCESS_TOKEN和PADDLEOCR_API_URL环境变量。
显著优点
- 多格式与多语言支持:原生支持PDF、JPG、PNG、BMP、TIFF等格式,覆盖110+种语言识别
- 智能布局分析:自动检测文本块、表格、公式等版面元素,保留原始文档结构
- T1级可信来源:基于百度PaddlePaddle开源项目,GitHub 40k+ stars,社区活跃度极高
- 安全实践良好:API Token通过环境变量读取,无硬编码密钥;HTTPS加密传输;临时文件自动清理
- 结构化输出:直接输出Markdown格式,便于后续文档处理和知识库构建
潜在缺点与局限性
- 完全依赖外部服务:功能100%依赖PaddleOCR API可用性,无离线能力;API配额耗尽或网络中断将导致服务不可用
- 数据外发风险:用户文件需上传至第三方服务器处理,虽为功能必需,但涉及敏感文档时需评估合规性
- 配置门槛:需自行申请百度AI Studio账号、获取Token、配置API端点,对非技术用户有一定门槛
- 成本因素:高频或大批量使用可能产生API调用费用,需关注配额限制
- 无本地缓存机制:重复解析相同文档会产生冗余API调用,建议自行实现缓存层
适合人群
- 开发者和技术团队:需要批量处理文档、构建知识库、实现RAG(检索增强生成)流水线
- 企业文档数字化:需将历史纸质档案、扫描件转换为可检索的结构化数据
- 多语言文档处理:涉及国际化业务,需识别多语种混合文档
- 已有百度AI生态用户:已具备百度AI Studio账号和配额资源
常规风险
- 隐私合规:上传文档可能包含敏感信息,需确认符合GDPR/数据安全法等法规要求
- 服务连续性:建议确认API SLA条款,关键业务建议准备降级方案或本地OCR备选
- 端点验证:确保配置的API URL为官方服务或可信私有部署,避免中间人攻击
技能正文
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
- Multi-format support: PDF and image files (JPG, PNG, BMP, TIFF)
- Two parsing modes:
- Sync mode: Fast response for small files (<600s timeout)
- Async mode: For large files with progress polling
- Layout analysis: Automatic detection of text blocks, tables, formulas
- Multi-language: Support for 110+ languages
- Structured output: Markdown format with preserved document structure
Setup
- Visit PaddleOCR to obtain your API credentials
- 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.jpg
# Parse PDF
{baseDir}/paddleocr_parse.sh -t pdf document.pdf
# Parse from URL
{baseDir}/paddleocr_parse.sh https://example.com/document.jpg
# Save output to file
{baseDir}/paddleocr_parse.sh -o result.json document.jpg
# Verbose 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.pdf
# Parse from URL with async mode
{baseDir}/paddleocr_parse.sh --async -t pdf https://example.com/doc.pdf
# Save 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.jpg
# Async mode
python3 {baseDir}/paddleocr_parse.py --async-mode document.pdf
# With 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:
- Missing required environment variables
- File not found
- API authentication failures
- Invalid JSON responses
- API error codes (non-zero)
Quota Information
See official documentation: https://ai.baidu.com/ai-doc/AISTUDIO/Xmjclapam
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。