New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Extracts Chinese and English text from scanned PDFs and images through four selectable OCR engines.

skills.sh installs
439
GitHub stars
13
last updated
Jun 3, 2026
View on GitHub

What it does

  • Covers text extraction from scanned PDF pages and image files in JPG, PNG, BMP, GIF, TIFF, and WEBP formats
  • Supports four engines: RapidOCR and PaddleOCR (local), RapidDoc (layout-aware), and SiliconFlow API (cloud)
  • Switches from RapidOCR to the SiliconFlow API automatically when RapidOCR initialization fails
  • Returns a dict with text, page_count, and engine keys, and suits contracts, reports, and screenshots

Install

$ npx -y skills add yejinlei/pdf-ocr-skill --skill pdf-ocr-skill -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

PDF OCR Skill

中文版本

PDF OCR技能用于从影印版PDF文件和图片文件中提取文字内容。该技能支持两种OCR引擎:

  • RapidOCR(本地引擎):无需API密钥,免费使用,识别速度快
  • 硅基流动大模型(云端引擎):使用AI大模型进行高精度OCR识别

功能特性

  • 支持影印版PDF文件的文字提取
  • 支持多种图片格式的文字识别(JPG、PNG、BMP、GIF、TIFF、WEBP)
  • 四引擎支持:RapidOCR(本地)、RapidDoc(增强)、PaddleOCR(本地)和硅基流动API(云端)
  • 支持中文和英文文字识别
  • 保持文字的顺序和结构
  • 自动将PDF页面转换为图片进行识别
  • 智能引擎切换:当RapidOCR初始化失败时自动切换到硅基流动API

安装

依赖要求
pip install pymupdf pillow requests python-dotenv
可选依赖(推荐)

安装RapidOCR以获得本地识别能力:

pip install rapidocr_onnxruntime

环境变量配置

  1. 复制 .env.example 文件并重命名为 .env
  2. 根据需要配置以下选项:
# OCR引擎选择
# - "rapid": 使用RapidOCR本地引擎(默认,无需API密钥)
# - "rapidoc": 使用RapidDoc增强引擎(无需API密钥)
# - "paddle": 使用PaddleOCR本地引擎(无需API密钥)
# - "siliconflow": 使用硅基流动API引擎(需要API密钥)
OCR_ENGINE=rapid

# 如果使用硅基流动API引擎,需要配置以下选项:
SILICON_FLOW_API_KEY=your_api_key_here
SILICON_FLOW_OCR_MODEL=deepseek-ai/DeepSeek-OCR

快速开始

使用默认引擎(RapidOCR本地识别)
# 导入OCR处理器
from scripts.pdf_ocr_processor import PDFOCRProcessor

# 创建处理器实例(默认使用RapidOCR)
processor = PDFOCRProcessor()

# 执行PDF OCR识别
result = processor.ocr_pdf('path/to/your/scanned.pdf')

Details

Repository
github.com/yejinlei/pdf-ocr-skill
Categories
Office Files & Slides, Data Science & Analytics, Python
First seen
Jun 3, 2026

More from yejinlei/pdf-ocr-skill

All 2

Similar to Pdf Ocr Skill

More Office Files & Slides