{
  "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": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/pdf-ocr-tool",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=pdf-ocr-tool",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "_meta.json",
      "analyzer.py",
      "hooks/install-deps.sh",
      "hooks/post-install.sh"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "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."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "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."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/pdf-ocr-tool",
    "agentPageUrl": "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"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "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."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "PDF OCR Tool - Intelligent PDF to Markdown Converter",
        "body": "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."
      },
      {
        "title": "Features",
        "body": "✅ Smart Content Detection: Automatically identifies page content type (text/table/figure)\n✅ Mixed Mode: Splits pages into multiple regions for processing different content types\n✅ Multiple Processing Modes: Supports text, table, figure, mixed, and auto modes\n✅ PDF Page-by-Page Processing: Converts PDF to images and processes each page\n✅ Image OCR: Supports OCR for single images\n✅ Custom Prompts: Adjustable OCR prompts based on requirements\n✅ Flexible Configuration: Customizable Ollama host, port, and model\n✅ uv Package Management: Uses uv for Python dependency management"
      },
      {
        "title": "1. Prerequisites",
        "body": "# Install Ollama\ncurl -fsSL https://ollama.com/install.sh | sh\nollama pull glm-ocr:q8_0\n\n# Install poppler-utils (for PDF to image conversion)\nsudo apt install poppler-utils  # Debian/Ubuntu\nbrew install poppler            # macOS\n\n# Install uv package manager\ncurl -LsSf https://astral.sh/uv/install.sh | sh"
      },
      {
        "title": "2. Install with uv (Recommended)",
        "body": "cd skills/pdf-ocr-tool\nuv venv\nsource .venv/bin/activate\nuv add requests Pillow"
      },
      {
        "title": "3. Install via ClawHub",
        "body": "npx clawhub install pdf-ocr-tool"
      },
      {
        "title": "4. Manual Installation",
        "body": "# Clone or download skill\ngit clone <repo> ~/.openclaw/workspace/skills/pdf-ocr-tool\n\n# Create virtual environment and install dependencies\ncd ~/.openclaw/workspace/skills/pdf-ocr-tool\nuv venv\nsource .venv/bin/activate\nuv add requests Pillow\n\n# Run post-install script\nbash hooks/post-install.sh"
      },
      {
        "title": "Basic Usage",
        "body": "# Auto-detect content type (recommended)\npython ocr_tool.py --input document.pdf --output result.md\n\n# Specify processing mode\npython ocr_tool.py --input document.pdf --output result.md --mode text\npython ocr_tool.py --input document.pdf --output result.md --mode table\npython ocr_tool.py --input document.pdf --output result.md --mode figure\n\n# Mixed mode: split page into regions\npython ocr_tool.py --input document.pdf --output result.md --granularity region\n\n# Process a single image\npython ocr_tool.py --input image.png --output result.md --mode mixed"
      },
      {
        "title": "Advanced Configuration",
        "body": "# Specify Ollama host and port\npython ocr_tool.py --input document.pdf --output result.md \\\n  --host localhost --port 11434\n\n# Use different model\npython ocr_tool.py --input document.pdf --output result.md \\\n  --model glm-ocr:q8_0\n\n# Custom prompt\npython ocr_tool.py --input image.png --output result.md \\\n  --prompt \"Convert this table to Markdown format, keeping rows and columns aligned\"\n\n# Save figure region images\npython ocr_tool.py --input document.pdf --output result.md --save-images"
      },
      {
        "title": "Environment Configuration",
        "body": "# Set default configuration\nexport OLLAMA_HOST=\"localhost\"\nexport OLLAMA_PORT=\"11434\"\nexport OCR_MODEL=\"glm-ocr:q8_0\"\n\n# Run\npython ocr_tool.py --input document.pdf --output result.md"
      },
      {
        "title": "Processing Modes",
        "body": "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"
      },
      {
        "title": "Mixed Mode (Granularity)",
        "body": "When using --granularity region:\n\nPage is split vertically into multiple regions (default: 3)\nEach region is independently analyzed for content type\nCorresponding prompts are used for OCR\nFinal results are combined into complete Markdown"
      },
      {
        "title": "PDF Output Example",
        "body": "# PDF to Markdown Result\n**Total Pages**: 15\n**Model**: glm-ocr:q8_0\n**Mode**: auto\n**Generated**: 2026-02-27T01:00:00+08:00\n\n---\n\n## Page 1\n*Type: mixed*\n\n### Region 1 (text)\n[OCR recognized text content]\n\n### Region 2 (table)\n<table>\n<tr><th>Column 1</th><th>Column 2</th></tr>\n<tr><td>Data 1</td><td>Data 2</td></tr>\n</table>\n\n### Region 3 (figure)\n[Chart description]\n![Chart](./images/page_1_region_3.png)\n\n---"
      },
      {
        "title": "Image Output Example",
        "body": "# image.png OCR Result\nModel: glm-ocr:q8_0\nMode: table\n\n---\n\n[OCR recognized result]"
      },
      {
        "title": "Prompt Templates",
        "body": "The tool includes four built-in prompt templates in the prompts/ directory:"
      },
      {
        "title": "Text Mode (prompts/text.md)",
        "body": "Convert the text in this region to Markdown format.\n- Preserve paragraph structure and heading levels\n- Handle lists correctly\n- Preserve mathematical formulas\n- Maintain citations and references"
      },
      {
        "title": "Table Mode (prompts/table.md)",
        "body": "Convert the table in this region to Markdown table format.\n- Maintain row and column alignment\n- Preserve all data and values\n- Handle merged cells\n- Preserve headers and units"
      },
      {
        "title": "Figure Mode (prompts/figure.md)",
        "body": "Analyze the chart or image in this region:\n1. Chart type (bar, line, pie, flowchart, etc.)\n2. Titles and axis labels\n3. Data trends and key observations\n4. Important values and anomalies\nDescribe in Markdown format."
      },
      {
        "title": "Using in OpenClaw",
        "body": "import subprocess\nfrom pathlib import Path\n\n# Process PDF (auto mode)\nsubprocess.run([\n    \"python\", \"skills/pdf-ocr-tool/ocr_tool.py\",\n    \"--input\", \"/path/to/document.pdf\",\n    \"--output\", \"/tmp/result.md\",\n    \"--mode\", \"auto\"\n])\n\n# Read result\nwith open(\"/tmp/result.md\", \"r\") as f:\n    markdown_content = f.read()\n\n# Process single image (table mode)\nsubprocess.run([\n    \"python\", \"skills/pdf-ocr-tool/ocr_tool.py\",\n    \"--input\", \"/path/to/table.png\",\n    \"--output\", \"/tmp/table.md\",\n    \"--mode\", \"table\"\n])\n\n# Mixed mode for complex PDF\nsubprocess.run([\n    \"python\", \"skills/pdf-ocr-tool/ocr_tool.py\",\n    \"--input\", \"/path/to/mixed.pdf\",\n    \"--output\", \"/tmp/mixed.md\",\n    \"--granularity\", \"region\",  # Split into regions\n    \"--save-images\"  # Save figure images\n])"
      },
      {
        "title": "Model Not Installed",
        "body": "ollama pull glm-ocr:q8_0"
      },
      {
        "title": "Service Not Running",
        "body": "ollama serve"
      },
      {
        "title": "Missing pdftoppm",
        "body": "sudo apt install poppler-utils  # Debian/Ubuntu\nbrew install poppler            # macOS"
      },
      {
        "title": "Poor OCR Results",
        "body": "Try different modes: --mode text or --mode mixed\nUse custom prompts: --prompt \"your prompt here\"\nCheck image quality (resolution, clarity)\nTry mixed mode: --granularity region"
      },
      {
        "title": "Dependency Issues",
        "body": "cd skills/pdf-ocr-tool\nsource .venv/bin/activate\nuv sync  # Reinstall all dependencies"
      },
      {
        "title": "Related Resources",
        "body": "Ollama API Documentation\nGLM-OCR Model Page\npoppler-utils\nuv Package Manager"
      },
      {
        "title": "Version History",
        "body": "v1.2.0 - English prompts, install-deps.sh, fixed .gitignore\nv1.1.0 - Added mixed mode, region splitting, pyproject.toml\nv1.0.0 - Initial version with basic OCR functionality"
      },
      {
        "title": "Credits",
        "body": "This tool is developed and maintained by the OpenClaw community."
      },
      {
        "title": "License",
        "body": "MIT License"
      }
    ],
    "body": "PDF OCR Tool - Intelligent PDF to Markdown Converter\n\nUses 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.\n\nFeatures\n✅ Smart Content Detection: Automatically identifies page content type (text/table/figure)\n✅ Mixed Mode: Splits pages into multiple regions for processing different content types\n✅ Multiple Processing Modes: Supports text, table, figure, mixed, and auto modes\n✅ PDF Page-by-Page Processing: Converts PDF to images and processes each page\n✅ Image OCR: Supports OCR for single images\n✅ Custom Prompts: Adjustable OCR prompts based on requirements\n✅ Flexible Configuration: Customizable Ollama host, port, and model\n✅ uv Package Management: Uses uv for Python dependency management\nInstallation\n1. Prerequisites\n# Install Ollama\ncurl -fsSL https://ollama.com/install.sh | sh\nollama pull glm-ocr:q8_0\n\n# Install poppler-utils (for PDF to image conversion)\nsudo apt install poppler-utils  # Debian/Ubuntu\nbrew install poppler            # macOS\n\n# Install uv package manager\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n2. Install with uv (Recommended)\ncd skills/pdf-ocr-tool\nuv venv\nsource .venv/bin/activate\nuv add requests Pillow\n\n3. Install via ClawHub\nnpx clawhub install pdf-ocr-tool\n\n4. Manual Installation\n# Clone or download skill\ngit clone <repo> ~/.openclaw/workspace/skills/pdf-ocr-tool\n\n# Create virtual environment and install dependencies\ncd ~/.openclaw/workspace/skills/pdf-ocr-tool\nuv venv\nsource .venv/bin/activate\nuv add requests Pillow\n\n# Run post-install script\nbash hooks/post-install.sh\n\nUsage\nBasic Usage\n# Auto-detect content type (recommended)\npython ocr_tool.py --input document.pdf --output result.md\n\n# Specify processing mode\npython ocr_tool.py --input document.pdf --output result.md --mode text\npython ocr_tool.py --input document.pdf --output result.md --mode table\npython ocr_tool.py --input document.pdf --output result.md --mode figure\n\n# Mixed mode: split page into regions\npython ocr_tool.py --input document.pdf --output result.md --granularity region\n\n# Process a single image\npython ocr_tool.py --input image.png --output result.md --mode mixed\n\nAdvanced Configuration\n# Specify Ollama host and port\npython ocr_tool.py --input document.pdf --output result.md \\\n  --host localhost --port 11434\n\n# Use different model\npython ocr_tool.py --input document.pdf --output result.md \\\n  --model glm-ocr:q8_0\n\n# Custom prompt\npython ocr_tool.py --input image.png --output result.md \\\n  --prompt \"Convert this table to Markdown format, keeping rows and columns aligned\"\n\n# Save figure region images\npython ocr_tool.py --input document.pdf --output result.md --save-images\n\nEnvironment Configuration\n# Set default configuration\nexport OLLAMA_HOST=\"localhost\"\nexport OLLAMA_PORT=\"11434\"\nexport OCR_MODEL=\"glm-ocr:q8_0\"\n\n# Run\npython ocr_tool.py --input document.pdf --output result.md\n\nProcessing Modes\nMode\tDescription\tUse Case\nauto\tAuto-detect content type\tGeneral use (default)\ntext\tPure text recognition\tAcademic papers, articles, reports\ntable\tTable recognition\tData tables, financial reports\nfigure\tChart/figure recognition\tStatistical charts, flowcharts, diagrams\nmixed\tMixed mode\tPages with multiple content types\nMixed Mode (Granularity)\n\nWhen using --granularity region:\n\nPage is split vertically into multiple regions (default: 3)\nEach region is independently analyzed for content type\nCorresponding prompts are used for OCR\nFinal results are combined into complete Markdown\nOutput Format\nPDF Output Example\n# PDF to Markdown Result\n**Total Pages**: 15\n**Model**: glm-ocr:q8_0\n**Mode**: auto\n**Generated**: 2026-02-27T01:00:00+08:00\n\n---\n\n## Page 1\n*Type: mixed*\n\n### Region 1 (text)\n[OCR recognized text content]\n\n### Region 2 (table)\n<table>\n<tr><th>Column 1</th><th>Column 2</th></tr>\n<tr><td>Data 1</td><td>Data 2</td></tr>\n</table>\n\n### Region 3 (figure)\n[Chart description]\n![Chart](./images/page_1_region_3.png)\n\n---\n\nImage Output Example\n# image.png OCR Result\nModel: glm-ocr:q8_0\nMode: table\n\n---\n\n[OCR recognized result]\n\nPrompt Templates\n\nThe tool includes four built-in prompt templates in the prompts/ directory:\n\nText Mode (prompts/text.md)\nConvert the text in this region to Markdown format.\n- Preserve paragraph structure and heading levels\n- Handle lists correctly\n- Preserve mathematical formulas\n- Maintain citations and references\n\nTable Mode (prompts/table.md)\nConvert the table in this region to Markdown table format.\n- Maintain row and column alignment\n- Preserve all data and values\n- Handle merged cells\n- Preserve headers and units\n\nFigure Mode (prompts/figure.md)\nAnalyze the chart or image in this region:\n1. Chart type (bar, line, pie, flowchart, etc.)\n2. Titles and axis labels\n3. Data trends and key observations\n4. Important values and anomalies\nDescribe in Markdown format.\n\nUsing in OpenClaw\nimport subprocess\nfrom pathlib import Path\n\n# Process PDF (auto mode)\nsubprocess.run([\n    \"python\", \"skills/pdf-ocr-tool/ocr_tool.py\",\n    \"--input\", \"/path/to/document.pdf\",\n    \"--output\", \"/tmp/result.md\",\n    \"--mode\", \"auto\"\n])\n\n# Read result\nwith open(\"/tmp/result.md\", \"r\") as f:\n    markdown_content = f.read()\n\n# Process single image (table mode)\nsubprocess.run([\n    \"python\", \"skills/pdf-ocr-tool/ocr_tool.py\",\n    \"--input\", \"/path/to/table.png\",\n    \"--output\", \"/tmp/table.md\",\n    \"--mode\", \"table\"\n])\n\n# Mixed mode for complex PDF\nsubprocess.run([\n    \"python\", \"skills/pdf-ocr-tool/ocr_tool.py\",\n    \"--input\", \"/path/to/mixed.pdf\",\n    \"--output\", \"/tmp/mixed.md\",\n    \"--granularity\", \"region\",  # Split into regions\n    \"--save-images\"  # Save figure images\n])\n\nTroubleshooting\nModel Not Installed\nollama pull glm-ocr:q8_0\n\nService Not Running\nollama serve\n\nMissing pdftoppm\nsudo apt install poppler-utils  # Debian/Ubuntu\nbrew install poppler            # macOS\n\nPoor OCR Results\nTry different modes: --mode text or --mode mixed\nUse custom prompts: --prompt \"your prompt here\"\nCheck image quality (resolution, clarity)\nTry mixed mode: --granularity region\nDependency Issues\ncd skills/pdf-ocr-tool\nsource .venv/bin/activate\nuv sync  # Reinstall all dependencies\n\nRelated Resources\nOllama API Documentation\nGLM-OCR Model Page\npoppler-utils\nuv Package Manager\nVersion History\nv1.2.0 - English prompts, install-deps.sh, fixed .gitignore\nv1.1.0 - Added mixed mode, region splitting, pyproject.toml\nv1.0.0 - Initial version with basic OCR functionality\nCredits\n\nThis tool is developed and maintained by the OpenClaw community.\n\nLicense\n\nMIT License"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/TsukiSama9292/pdf-ocr-tool",
    "publisherUrl": "https://clawhub.ai/TsukiSama9292/pdf-ocr-tool",
    "owner": "TsukiSama9292",
    "version": "1.3.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "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"
  }
}