PDF Splitter Ocr

Description

XSpoonAi 5a655b0 3 files · 10.7 KB Updated

File contents

Description

Split PDF documents and perform optical character recognition (OCR) for text extraction and searchability. Supports batch processing and text indexing.

Inputs

{
  "pdf_path": "Path to PDF file",
  "action": "split|ocr|extract",
  "pages": "1-5|all"
}

Outputs

{
  "ok": true,
  "data": {
    "text": "Extracted text",
    "pages": 5
  }
}

Usage

Demo Mode

python scripts/main.py --demo

Extract Text

echo '{"pdf_path":"document.pdf","action":"extract"}' | python3 scripts/main.py

Examples

Example 1: OCR PDF

$ echo '{"pdf_path":"document.pdf","action":"ocr","pages":"1-3"}' | python3 scripts/main.py
{
  "ok": true,
  "data": {
    "text": "Extracted text content...",
    "pages": 3
  }
}

Error Handling

When an error occurs, the skill returns:

{
  "ok": false,
  "error": "Error description",
  "details": {
    "pdf_path": "File not found"
  }
}

XSpoonAi/spoon-awesome-skill/tree/main/ai-productivity/pdf-splitter-ocr commit 5a655b00b5

Frequently asked questions

npx skillmds@latest add xspoonai/pdf-splitter-ocr