document-ocr

Extracts raw text from PDF and image files using pymupdf, liteparse, and vision fallback.

1|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/tapway/shogun-os --skill document-ocr-tapway
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: document-ocr
Source: https://github.com/tapway/shogun-os/tree/main/skills/general/document-ocr
Command: npx skills add https://github.com/tapway/shogun-os --skill document-ocr-tapway

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pymupdf, liteparse, and includes scripts (resource) components.

What problem does it solve? Getting text out of PDFs and images is inconsistent: some PDFs are born-digital, others are scanned images requiring OCR. This Skill provides a single extraction entry point that automatically picks the right engine, returning plain text without manual tool selection. ## Core Features & Use Cases - Three-tier extraction pipeline: Tries pymupdf for text-based PDFs, falls back to liteparse OCR for scanned documents and images, then to a vision model as final fallback. - Strict scope separation: Returns raw text only — classification, field extraction, and storage are delegated to separate skills (document-interpretation, document-storage). - Use Case: A user receives a scanned supplier invoice as a PDF. The Skill extracts the raw text via liteparse OCR, which a downstream skill then interprets into structured fields like invoice number and total. ## Quick Start Ask the agent to extract the text from a PDF or image file by providing its local path, for example a downloaded invoice or receipt.

Frequently Asked Questions about document-ocr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract text from a PDF in Python?

Use pymupdf to open the PDF and call get_text on each page, joining the results into a single string. This works instantly for text-based PDFs but returns empty output for scanned documents, which require OCR instead.

How to OCR a scanned PDF or image file?

Use liteparse via its lit CLI with the parse command to run OCR on scanned PDFs and images, outputting markdown-formatted text. If liteparse is unavailable, a vision model can serve as a fallback extraction method.

pymupdf vs liteparse for PDF text extraction?

pymupdf is fast and ideal for born-digital PDFs with embedded text layers. liteparse performs OCR, making it necessary for scanned PDFs and image files where no text layer exists.

Why does PDF text extraction return empty output?

Empty output usually means the PDF is a scanned image without a text layer, so pymupdf finds nothing to extract. Fall back to an OCR engine like liteparse, and always validate that extracted text is non-empty before returning it.

Can this extract text from files stored in Google Drive?

Yes, but the file must be downloaded locally first using a Google Drive API tool, then the local path is passed to the extraction function. The OCR step itself only accepts local file paths or file bytes.