Dual-engine OCR for extracting text from scanned PDFs and images with local or cloud processing.
Works with
Supports RapidOCR (local, free, no API key) and SiliconFlow API (cloud-based, high precision) with automatic fallback when local engine fails
Handles scanned PDFs and multiple image formats (JPG, PNG, BMP, GIF, TIFF, WEBP) with Chinese and English text recognition
Preserves text order and structure; automatically converts PDF pages to images for processing
Batch processing capability f
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionpdf-ocrExecute the skills CLI command in your project's root directory to begin installation:
Fetches pdf-ocr from yejinlei/pdf-ocr-skill and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate pdf-ocr. Access via /pdf-ocr in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
14
total installs
14
this week
3
GitHub stars
0
upvotes
Run in your terminal
14
installs
14
this week
3
stars
PDF OCR技能用于从影印版PDF文件和图片文件中提取文字内容。该技能支持两种OCR引擎:
pip install pymupdf pillow requests python-dotenv
安装RapidOCR以获得本地识别能力:
pip install rapidocr_onnxruntime
.env.example 文件并重命名为 .env# OCR引擎选择
# - "rapid": 使用RapidOCR本地引擎(默认,无需API密钥)
# - "siliconflow": 使用硅基流动API引擎(需要API密钥)
OCR_ENGINE=rapid
# 如果使用硅基流动API引擎,需要配置以下选项:
SILICON_FLOW_API_KEY=your_api_key_here
SILICON_FLOW_OCR_MODEL=deepseek-ai/DeepSeek-OCR
# 导入OCR处理器
from scripts.pdf_ocr_processor import PDFOCRProcessor
# 创建处理器实例(默认使用RapidOCR)
processor = PDFOCRProcessor()
# 执行PDF OCR识别
result = processor.ocr_pdf('path/to/your/scanned.pdf')
# 获取识别结果
print(f"识别完成,共 {result['page_count']} 页")
print(f"使用引擎: {result['engine']}")
print(result['text'])
# 导入OCR处理器
from scripts.pdf_ocr_processor import PDFOCRProcessor
# 创建处理器实例,指定使用硅基流动API
processor = PDFOCRProcessor(engine="siliconflow")
# 执行PDF OCR识别
result = processor.ocr_pdf('path/to/your/scanned.pdf')
# 获取识别结果
print(f"识别完成,共 {result['page_count']} 页")
print(result['text'])
# 导入OCR处理器
from scripts.pdf_ocr_processor import PDFOCRProcessor
# 创建处理器实例
processor = PDFOCRProcessor() # 或 PDFOCRProcessor(engine="siliconflow")
# 执行图片OCR识别
result = processor.ocr_image_file('path/to/your/image.jpg')
# 获取识别结果
print(f"识别结果: {result['text']}")
# 使用默认RapidOCR引擎
python pdf_ocr_processor.py your_document.pdf
# 使用硅基流动API引擎
python pdf_ocr_processor.py your_document.pdf siliconflow
import os
from scripts.pdf_ocr_processor import PDFOCRProcessor
# 创建处理器实例
processor = PDFOCRProcessor()
# 批量处理目录中的所有PDF文件
pdf_dir = "path/to/pdf/files"
output_dir = "path/to/output"
os.makedirs(output_dir, exist_ok=True)
for pdf_file in os.listdir(pdf_dir):
if pdf_file.endswith('.pdf'):
pdf_path = os.path.join(pdf_dir, pdf_file)
output_path = os.path.join(output_dir, f"{os.path.splitext(pdf_file)[0]}.txt")
print(f"处理文件: {pdf_file}")
try:
result = processor.ocr_pdf(pdf_path)
# 保存识别结果到文本文件
with open(output_path, 'w', encoding='utf-8') as f:
f.write(f"=== PDF OCR 识别结果 ===\n")
f.write(f"文件名: {pdf_file}\n")
f.write(f"页数: {result['page_count']}\n")
f.write(f"使用引擎: {result['engine']}\n\n")
f.write(result['text'])
print(f"处理完成,结果已保存到: {output_path}")
except Exception as e:
print(f"处理失败: {e}")
from scripts.pdf_ocr_processor import PDFOCRProcessor
def process_with_best_engine(pdf_path):
"""尝试使用RapidOCR,如果效果不佳则使用硅基流动API"""
# 首先使用RapidOCR本地引擎
rapid_processor = PDFOCRProcessor(engine="rapid")
rapid_result = rapid_processor.ocr_pdf(pdf_path)
# 简单评估识别效果(例如:检查识别出的文本长度)
text_length = len(rapid_result['text'])
if text_length < 100: # 如果识别出的文本太短,可能效果不佳
print("RapidOCR识别效果可能不佳,尝试使用硅基流动API...")
silicon_processor = PDFOCRProcessor(engine="siliconflow")
silicon_result = silicon_processor.ocr_pdf(pdf_path)
return silicon_result
else:
return rapid_result
# 使用示例
result = process_with_best_engine('path/to/your/document.pdf')
print(f"识别完成,使用引擎: {result['engine']}")
print(result['text'])
{
"text": "识别的完整文本内容",
"page_count": 页数, # 图片文件始终为1
"engine": "rapid" | "siliconflow" # 使用的OCR引擎
}
RapidOCR引擎:
硅基流动API引擎:
对于复杂的扫描版PDF或图片,识别准确率可能会有所不同
建议使用高清晰度的扫描版PDF或图片以获得更好的识别效果
在与 AI IDE 中的助手交互时,您可以使用以下提示词来指定使用不同的 OCR 引擎:
示例 1:使用本地引擎
用户:帮我处理这个扫描版 PDF,用本地 OCR 引擎快速识别
助手:好的,我将使用 RapidOCR 本地引擎为您处理。请提供 PDF 文件路径。
示例 2:使用云端引擎
用户:这个 PDF 包含手写体,需要高精度识别,用硅基流动 API
助手:理解,我将使用硅基流动 API 大模型为您处理。请提供 PDF 文件路径和您的 API 密钥(如果尚未配置)。
示例 3:自动选择
用户:帮我识别这个 PDF,选择最合适的引擎
助手:我将默认使用 RapidOCR 本地引擎为您处理。如果识别效果不理想,我们可以尝试使用硅基流动 API。
当 AI 助手接收到这些提示词时,会:
通过使用这些提示词,您可以在与 AI IDE 交互时灵活控制 OCR 引擎的选择,获得最佳的识别效果
RapidOCR初始化失败
ModuleNotFoundError: No module named 'rapidocr_onnxruntime'pip install rapidPrerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
yejinlei/pdf-ocr-skill
duc01226/easyplatform
steipete/clawdis
claude-office-skills/skills
alchaincyf/huashu-skills
daymade/claude-code-skills
pdf-ocr is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Keeps context tight: pdf-ocr is the kind of skill you can hand to a new teammate without a long onboarding doc.
pdf-ocr fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
I recommend pdf-ocr for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
We added pdf-ocr from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Solid pick for teams standardizing on skills: pdf-ocr is focused, and the summary matches what you get after install.
pdf-ocr has been reliable in day-to-day use. Documentation quality is above average for community skills.
pdf-ocr fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
pdf-ocr reduced setup friction for our internal harness; good balance of opinion and flexibility.
We added pdf-ocr from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
showing 1-10 of 61