pdf-ocr-skill
支持四引擎的PDF OCR识别技能,可从影印版PDF文件和图片文件中提取中英文文字内容 | PDF OCR Skill with quadruple-engine support, capable of extracting Chinese and English text from scanned PDF files and image files
Security Assessment
About pdf-ocr-skill
PDF OCR Skill extracts Chinese and English text from scanned (image-based) PDFs and image files, packaged as a Python tool with a PDFOCRProcessor class and a command-line entry point. It solves the problem of getting selectable text out of photocopied documents, scanned contracts, books, reports, and screenshots where copy-paste does not work. It converts PDF pages to images and runs OCR, preserving reading order and structure.
It offers multiple engines selectable by an OCR_ENGINE environment variable or a CLI argument: RapidOCR as a free, offline local default that needs no API key; a RapidDoc enhanced engine adding layout analysis, table, and formula recognition; a PaddleOCR local engine; and a SiliconFlow cloud engine that calls a large model (for example DeepSeek-OCR) for high-accuracy recognition. It includes intelligent fallback, switching to the cloud API when local initialization fails, and a documented pattern for trying RapidOCR first and escalating to the cloud when the extracted text looks too short. The documentation covers installation (pymupdf, pillow, requests, python-dotenv, plus optional rapidocr_onnxruntime), environment configuration through a .env file, quick-start snippets, command-line usage, batch processing of directories, saving intermediate images, supported formats (PDF plus JPG, PNG, BMP, GIF, TIFF, WEBP), and an engine comparison covering cost, speed, accuracy, and network dependence.
The target users are developers and analysts who need to digitize scanned documents or images, individually or in batch. Credentials for the optional cloud engine (a SiliconFlow API key) are configured via environment variables in a .env file, which is standard and safe practice; the local engines run entirely offline. Choosing the cloud engine sends document images to a third-party OCR service, which is an intended feature rather than a covert behavior, so users should be mindful of document sensitivity and API costs.
FAQ
Which OCR engines are available?
RapidOCR (free offline local default), RapidDoc (enhanced local engine with layout, table, and formula recognition), PaddleOCR (local), and SiliconFlow (cloud engine using a large model such as DeepSeek-OCR). It can auto-switch to the cloud API if a local engine fails to initialize.
Do I need an API key?
Only for the SiliconFlow cloud engine, configured as SILICON_FLOW_API_KEY in a .env file. The RapidOCR, RapidDoc, and PaddleOCR local engines run offline with no key required.
What file formats and languages are supported?
Scanned PDFs plus JPG, JPEG, PNG, BMP, GIF, TIFF, and WEBP images, with Chinese and English text recognition. Reading order and structure are preserved.
How do I install and run it?
Install pymupdf, pillow, requests, and python-dotenv (plus optional rapidocr_onnxruntime), then use the PDFOCRProcessor class in Python or run pdf_ocr_processor.py from the command line, passing an engine name as an argument. Batch processing over a directory is documented.
Does my document leave my machine?
Only if you choose the SiliconFlow cloud engine, which sends page images to a third-party API. The default RapidOCR and other local engines process everything on your machine with no network dependency.
Install pdf-ocr-skill
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
yejinlei/pdf-ocr-skill