Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By yejinleiMITIn 1 marketplace
Extracts text from scanned PDFs and images, including Chinese and English, with a local RapidOCR engine by default. The cloud SiliconFlow API needs an API key, and it claims the local engine needs none.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
Of the plugin's README
Chinese
1 marketplace, most starred first
pdf-ocr, ocr, text-extraction, scanned-pdf, pdf-to-text, image-to-text, chinese-ocr
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
一个支持多种OCR引擎的PDF文字提取技能,可以从影印版PDF文件和图片文件中提取文字内容。
pip install pymupdf pillow requests python-dotenv
安装RapidOCR以获得更好的本地识别效果:
pip install rapidocr_onnxruntime
.env.example 文件并重命名为 .env# OCR引擎选择
# - "rapid": 使用RapidOCR本地引擎(默认,无需API密钥)
# - "rapidoc": 使用RapidDoc增强引擎(无需API密钥)
# - "siliconflow": 使用硅基流动API引擎(需要API密钥)
OCR_ENGINE=rapid
# 如果使用硅基流动API引擎,需要配置以下选项:
SILICON_FLOW_API_KEY=your_api_key_here
SILICON_FLOW_OCR_MODEL=deepseek-ai/DeepSeek-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'])
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'])
from scripts.pdf_ocr_processor import PDFOCRProcessor
# 创建处理器实例,指定使用RapidDoc增强引擎
processor = PDFOCRProcessor(engine="rapidoc")
# 执行PDF OCR识别
result = processor.ocr_pdf('path/to/your/scanned.pdf')
# 获取识别结果
print(f"识别完成,共 {result['page_count']} 页")
print(f"使用引擎: {result['engine']}")
print(f"提取的图片数量: {result['images_count']}")
print("\n识别结果:")
print(result['text'])
if 'markdown' in result:
print("\nMarkdown结果:")
print(result['markdown'])
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
# 使用RapidDoc增强引擎
python pdf_ocr_processor.py your_document.pdf rapidoc
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(f"识别结果长度: {len(result['text'])} 字符")
print(result['text'])
from scripts.pdf_ocr_processor import PDFOCRProcessor
# 创建处理器实例
processor = PDFOCRProcessor()
# 执行PDF OCR识别并保存中间图片
result = processor.ocr_pdf('path/to/your/scanned.pdf', save_images=True)
print(f"识别完成,共 {result['page_count']} 页")
print(f"使用引擎: {result['engine']}")
if 'images_dir' in result and result['images_dir']:
print(f"中间图片已保存到: {result['images_dir']}")
print(result['text'])
import os
from scripts.pdf_ocr_processor import PDFOCRProcessor
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
yejinlei-pdf-ocr-skill@cascade-data-analytics is listed by joshuarweaver/cascade-data-analytics — review the source before installing
npx claudepluginhub joshuarweaver/cascade-data-analytics --plugin yejinlei-pdf-ocr-skillPlugins from other owners that cover similar ground