# Send Pdf Ocr Tool to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "pdf-ocr-tool",
    "name": "Pdf Ocr Tool",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/TsukiSama9292/pdf-ocr-tool",
    "canonicalUrl": "https://clawhub.ai/TsukiSama9292/pdf-ocr-tool",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/pdf-ocr-tool",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pdf-ocr-tool",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "_meta.json",
      "analyzer.py",
      "hooks/install-deps.sh",
      "hooks/post-install.sh"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "pdf-ocr-tool",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-03T01:59:27.729Z",
      "expiresAt": "2026-05-10T01:59:27.729Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pdf-ocr-tool",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pdf-ocr-tool",
        "contentDisposition": "attachment; filename=\"pdf-ocr-tool-1.3.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "pdf-ocr-tool"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/pdf-ocr-tool"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/pdf-ocr-tool",
    "downloadUrl": "https://openagent3.xyz/downloads/pdf-ocr-tool",
    "agentUrl": "https://openagent3.xyz/skills/pdf-ocr-tool/agent",
    "manifestUrl": "https://openagent3.xyz/skills/pdf-ocr-tool/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/pdf-ocr-tool/agent.md"
  }
}
```
## Documentation

### PDF OCR Tool - Intelligent PDF to Markdown Converter

Uses the Ollama GLM-OCR model to intelligently recognize text, tables, and figures in PDF pages, applying the most appropriate prompts for OCR processing and outputting structured Markdown documents.

### Features

✅ Smart Content Detection: Automatically identifies page content type (text/table/figure)
✅ Mixed Mode: Splits pages into multiple regions for processing different content types
✅ Multiple Processing Modes: Supports text, table, figure, mixed, and auto modes
✅ PDF Page-by-Page Processing: Converts PDF to images and processes each page
✅ Image OCR: Supports OCR for single images
✅ Custom Prompts: Adjustable OCR prompts based on requirements
✅ Flexible Configuration: Customizable Ollama host, port, and model
✅ uv Package Management: Uses uv for Python dependency management

### 1. Prerequisites

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama pull glm-ocr:q8_0

# Install poppler-utils (for PDF to image conversion)
sudo apt install poppler-utils  # Debian/Ubuntu
brew install poppler            # macOS

# Install uv package manager
curl -LsSf https://astral.sh/uv/install.sh | sh

### 2. Install with uv (Recommended)

cd skills/pdf-ocr-tool
uv venv
source .venv/bin/activate
uv add requests Pillow

### 3. Install via ClawHub

npx clawhub install pdf-ocr-tool

### 4. Manual Installation

# Clone or download skill
git clone <repo> ~/.openclaw/workspace/skills/pdf-ocr-tool

# Create virtual environment and install dependencies
cd ~/.openclaw/workspace/skills/pdf-ocr-tool
uv venv
source .venv/bin/activate
uv add requests Pillow

# Run post-install script
bash hooks/post-install.sh

### Basic Usage

# Auto-detect content type (recommended)
python ocr_tool.py --input document.pdf --output result.md

# Specify processing mode
python ocr_tool.py --input document.pdf --output result.md --mode text
python ocr_tool.py --input document.pdf --output result.md --mode table
python ocr_tool.py --input document.pdf --output result.md --mode figure

# Mixed mode: split page into regions
python ocr_tool.py --input document.pdf --output result.md --granularity region

# Process a single image
python ocr_tool.py --input image.png --output result.md --mode mixed

### Advanced Configuration

# Specify Ollama host and port
python ocr_tool.py --input document.pdf --output result.md \\
  --host localhost --port 11434

# Use different model
python ocr_tool.py --input document.pdf --output result.md \\
  --model glm-ocr:q8_0

# Custom prompt
python ocr_tool.py --input image.png --output result.md \\
  --prompt "Convert this table to Markdown format, keeping rows and columns aligned"

# Save figure region images
python ocr_tool.py --input document.pdf --output result.md --save-images

### Environment Configuration

# Set default configuration
export OLLAMA_HOST="localhost"
export OLLAMA_PORT="11434"
export OCR_MODEL="glm-ocr:q8_0"

# Run
python ocr_tool.py --input document.pdf --output result.md

### Processing Modes

ModeDescriptionUse CaseautoAuto-detect content typeGeneral use (default)textPure text recognitionAcademic papers, articles, reportstableTable recognitionData tables, financial reportsfigureChart/figure recognitionStatistical charts, flowcharts, diagramsmixedMixed modePages with multiple content types

### Mixed Mode (Granularity)

When using --granularity region:

Page is split vertically into multiple regions (default: 3)
Each region is independently analyzed for content type
Corresponding prompts are used for OCR
Final results are combined into complete Markdown

### PDF Output Example

# PDF to Markdown Result
**Total Pages**: 15
**Model**: glm-ocr:q8_0
**Mode**: auto
**Generated**: 2026-02-27T01:00:00+08:00

---

## Page 1
*Type: mixed*

### Region 1 (text)
[OCR recognized text content]

### Region 2 (table)
<table>
<tr><th>Column 1</th><th>Column 2</th></tr>
<tr><td>Data 1</td><td>Data 2</td></tr>
</table>

### Region 3 (figure)
[Chart description]
![Chart](./images/page_1_region_3.png)

---

### Image Output Example

# image.png OCR Result
Model: glm-ocr:q8_0
Mode: table

---

[OCR recognized result]

### Prompt Templates

The tool includes four built-in prompt templates in the prompts/ directory:

### Text Mode (prompts/text.md)

Convert the text in this region to Markdown format.
- Preserve paragraph structure and heading levels
- Handle lists correctly
- Preserve mathematical formulas
- Maintain citations and references

### Table Mode (prompts/table.md)

Convert the table in this region to Markdown table format.
- Maintain row and column alignment
- Preserve all data and values
- Handle merged cells
- Preserve headers and units

### Figure Mode (prompts/figure.md)

Analyze the chart or image in this region:
1. Chart type (bar, line, pie, flowchart, etc.)
2. Titles and axis labels
3. Data trends and key observations
4. Important values and anomalies
Describe in Markdown format.

### Using in OpenClaw

import subprocess
from pathlib import Path

# Process PDF (auto mode)
subprocess.run([
    "python", "skills/pdf-ocr-tool/ocr_tool.py",
    "--input", "/path/to/document.pdf",
    "--output", "/tmp/result.md",
    "--mode", "auto"
])

# Read result
with open("/tmp/result.md", "r") as f:
    markdown_content = f.read()

# Process single image (table mode)
subprocess.run([
    "python", "skills/pdf-ocr-tool/ocr_tool.py",
    "--input", "/path/to/table.png",
    "--output", "/tmp/table.md",
    "--mode", "table"
])

# Mixed mode for complex PDF
subprocess.run([
    "python", "skills/pdf-ocr-tool/ocr_tool.py",
    "--input", "/path/to/mixed.pdf",
    "--output", "/tmp/mixed.md",
    "--granularity", "region",  # Split into regions
    "--save-images"  # Save figure images
])

### Model Not Installed

ollama pull glm-ocr:q8_0

### Service Not Running

ollama serve

### Missing pdftoppm

sudo apt install poppler-utils  # Debian/Ubuntu
brew install poppler            # macOS

### Poor OCR Results

Try different modes: --mode text or --mode mixed
Use custom prompts: --prompt "your prompt here"
Check image quality (resolution, clarity)
Try mixed mode: --granularity region

### Dependency Issues

cd skills/pdf-ocr-tool
source .venv/bin/activate
uv sync  # Reinstall all dependencies

### Related Resources

Ollama API Documentation
GLM-OCR Model Page
poppler-utils
uv Package Manager

### Version History

v1.2.0 - English prompts, install-deps.sh, fixed .gitignore
v1.1.0 - Added mixed mode, region splitting, pyproject.toml
v1.0.0 - Initial version with basic OCR functionality

### Credits

This tool is developed and maintained by the OpenClaw community.

### License

MIT License
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: TsukiSama9292
- Version: 1.3.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-03T01:59:27.729Z
- Expires at: 2026-05-10T01:59:27.729Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/pdf-ocr-tool)
- [Send to Agent page](https://openagent3.xyz/skills/pdf-ocr-tool/agent)
- [JSON manifest](https://openagent3.xyz/skills/pdf-ocr-tool/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/pdf-ocr-tool/agent.md)
- [Download page](https://openagent3.xyz/downloads/pdf-ocr-tool)