doc-ocr

Extract editable text from PDFs, scans, and images using macOS Vision OCR.

3.4k|487|Updated Jul 25, 2025
One-click install
npx skills add https://github.com/davepoon/buildwithclaude --skill doc-ocr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: doc-ocr
Source: https://github.com/davepoon/buildwithclaude/tree/main/plugins/all-skills/skills/doc-ocr
Command: npx skills add https://github.com/davepoon/buildwithclaude --skill doc-ocr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pymupdf, pyobjc-framework-Vision, and includes scripts (resource) components.

What problem does it solve?

Scanned contracts, invoices, book pages, and screenshots contain text locked inside images that cannot be copied or edited. This Skill converts PDFs and image files into editable text, automatically detecting whether a PDF has a text layer or needs OCR.

Core Features & Use Cases

  • Automatic Scan Detection: PDFs with a text layer are extracted directly; scanned PDFs with fewer than 20 characters of embedded text are routed to OCR automatically.
  • Chinese and English OCR: Uses the built-in macOS Vision framework for accurate recognition of Simplified Chinese and English text, processed locally without uploading files.
  • Batch and Markdown Output: Process entire directories of files into one output file, with an optional Markdown mode.
  • Use Case: You receive a folder of scanned invoices as PDFs. Run the script on the directory to produce a single text file containing all invoice contents, ready for searching or data entry.

Quick Start

Use the doc-ocr skill to extract all text from the scanned contract.pdf file into an editable text file.

Frequently Asked Questions about doc-ocr

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

FAQPage Schema
How do I extract text from a scanned PDF on macOS?

Run the dococr.py script with the PDF path as argument. It first checks for an embedded text layer; if fewer than 20 characters are found, it renders each page at 200 DPI and runs macOS Vision OCR automatically.

How to OCR images containing Chinese and English text?

Use the macOS Vision framework's VNRecognizeTextRequest with recognition languages set to zh-Hans and en. The script handles this configuration and supports PNG, JPG, and TIFF image inputs directly.

Does this OCR tool work on Linux or Windows?

No, the OCR path depends on the macOS Vision framework via pyobjc, which is only available on macOS. On Linux you would need an alternative engine such as tesseract, which is not included in this script.

Can I batch process a folder of scanned documents?

Yes, pass a directory path instead of a single file. The script processes all PDF and image files in the folder and combines results into one output file specified with the -o flag.

Why does OCR fail on handwritten documents?

macOS Vision performs well on printed text and clear handwriting but does not guarantee accuracy on messy handwriting. Recognition quality depends on image clarity and the legibility of the writing.