关于 PDF OCR Extraction
PDF OCR Extraction 用于从扫描文档和图像型 PDF 中识别文字,支持纯文本或结构化输出、生成可搜索 PDF、选择页面和批量处理。手写文字及复杂内容可能需要人工复核。
主要功能
- 01识别扫描 PDF 中的文字
- 02输出纯文本或结构化内容
- 03生成可搜索 PDF
- 04选择页面和语言
- 05批量处理文档
适用场景
- 01让图像型 PDF 支持搜索
- 02提取表单字段
- 03批量处理扫描文档
- 04复核手写页面的识别结果
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ claude-office-skills/ skills --skill pdf-ocr-extraction安装后在 Claude Code 中输入/pdf-ocr-extraction确认已加载。
详细介绍
PDF OCR 提取
使用 OCR 技术从扫描文档和基于图像的 PDF 中提取文本。
概述
此技能可帮助你:
- 从扫描文档中提取文本
- 使图像 PDF 可搜索
- 将纸质文档数字化
- 处理手写文本(能力有限)
- 批量处理多个文档
使用方法
基本 OCR
"Extract text from this scanned PDF"
"OCR this document image"
"Make this PDF searchable"
使用选项
"Extract text from pages 1-10, English language"
"OCR this document, preserve layout"
"Extract and output as structured data"
文档类型
不同文档类型的 OCR 质量
| 文档类型 | 预期质量 | 提示 |
|---|---|---|
| 打字文档 | ⭐⭐⭐⭐⭐ 95%+ | 效果最佳 |
| 印刷书籍 | ⭐⭐⭐⭐ 90%+ | 注意纸张老化 |
| 表单 | ⭐⭐⭐⭐ 85%+ | 复选框可能需要手动处理 |
| 表格/数据 | ⭐⭐⭐ 80%+ | 可能需要修复结构 |
| 手写(工整) | ⭐⭐ 60-80% | 结果不一 |
| 手写(草书) | ⭐ 30-60% | 通常需要人工检查 |
| 混合内容 | ⭐⭐⭐ 75%+ | 取决于复杂程度 |
输出格式
纯文本提取
## OCR Result: [Document Name]
**Pages Processed**: [X]
**Language**: [Detected/Specified]
**Confidence**: [X]%
---
[Extracted text content here]
---
### Notes
- [Any issues or uncertainties]
- [Characters that may be incorrect]
结构化提取
## OCR Extraction: [Document Name]
### Document Info
| Field | Value |
|-------|-------|
| Title | [Extracted or inferred] |
| Date | [If found] |
| Author | [If found] |
### Content by Section
#### [Header 1]
[Content under this header]
#### [Header 2]
[Content under this header]
### Tables Found
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| [Data] | [Data] | [Data] |
### Uncertain Text
| Page | Original | Confidence | Possible |
|------|----------|------------|----------|
| 3 | "teh" | 70% | "the" |
| 5 | "l0ve" | 65% | "love" |
可搜索 PDF 输出
## OCR to Searchable PDF
**Source**: [filename.pdf]
**Output**: [filename_searchable.pdf]
### Processing Summary
| Metric | Value |
|--------|-------|
| Pages | [X] |
| Words extracted | [Y] |
| Average confidence | [Z]% |
| Processing time | [T] seconds |
### Quality Report
- [X] pages with 95%+ confidence
- [Y] pages with 80-94% confidence
- [Z] pages with <80% confidence (review recommended)
### Searchability
✅ Document is now text-searchable
✅ Original images preserved
✅ Text layer added behind images
预处理提示
图像质量检查清单
进行 OCR 前,请确保:
- 分辨率:至少 300 DPI(小号文本需 600 DPI)
- 对比度:白色背景上的黑色文本清晰可辨
- 对齐:文档摆放端正(无倾斜)
- 完整性:边缘没有被裁切
- 清洁度:没有污渍、痕迹或阴影
常见预处理步骤
| 问题 | 解决方案 |
|---|---|
| 分辨率低 | 先放大图像 |
| 倾斜/旋转 | 自动纠偏 |
| 对比度差 | 调整色阶/阈值 |
| 噪点/斑点 | 降噪 |
| 阴影 | 均匀照明 |
| 彩色文档 | 转换为灰度图 |
语言支持
支持的语言
- 优秀:英语、西班牙语、法语、德语、意大利语
- 良好:中文(简体/繁体)、日语、韩语
- 中等:阿拉伯语、希伯来语(支持 RTL)、印地语
- 基础:许多其他语言,质量不一
多语言文档
"OCR this document, detect language automatically"
"Extract text, primary: English, secondary: Chinese"
特定内容的处理
表单和复选框
## Form Extraction: [Form Name]
### Field Values
| Field | Value | Confidence |
|-------|-------|------------|
| Name | John Smith | 98% |
| Date | 01/15/2026 | 95% |
| Address | 123 Main St | 92% |
### Checkboxes
| Question | Checked |
|----------|---------|
| Option A | ☑️ Yes |
| Option B | ☐ No |
| Option C | ☑️ Yes |
### Signature
[Signature detected on page X - cannot extract text]
表格
## Table Extraction
### Table 1 (Page 2)
| Header A | Header B | Header C |
|----------|----------|----------|
| Value 1 | Value 2 | Value 3 |
| Value 4 | Value 5 | Value 6 |
**Table confidence**: 85%
**Note**: Column 3 may have alignment issues
手写文本
## Handwritten Text Extraction
**Legibility Assessment**: [Good/Fair/Poor]
**Recommended**: Manual review
### Extracted Text (Confidence: 65%)
[Extracted text with uncertain words marked]
### Uncertain Words
| Original | Best Guess | Alternatives |
|----------|------------|--------------|
| [image] | "meeting" | "meeting", "meaning" |
| [image] | "Tuesday" | "Tuesday", "Thursday" |
⚠️ **Low confidence extraction - please verify manually**
批量处理
批量 OCR 任务
## Batch OCR Processing
**Folder**: [Path]
**Total Documents**: [X]
**Status**: [In Progress/Complete]
### Results
| File | Pages | Confidence | Status |
|------|-------|------------|--------|
| doc1.pdf | 5 | 96% | ✅ Complete |
| doc2.pdf | 12 | 88% | ✅ Complete |
| doc3.pdf | 3 | 72% | ⚠️ Review |
| doc4.pdf | 8 | - | ❌ Failed |
### Issues
- doc3.pdf: Pages 2-3 have handwriting
- doc4.pdf: File corrupted
### Summary
- Successful: [X]
- Need Review: [Y]
- Failed: [Z]
工具推荐
云服务
- Google Cloud Vision(准确率极高)
- Amazon Textract(适用于表单)
- Azure Computer Vision(表现均衡)
- Adobe Acrobat(集成式)
桌面软件
- ABBYY FineReader(准确率最高)
- Adobe Acrobat Pro(可靠)
- Readiris(性价比高)
- Tesseract(免费、开源)
编程库
- pytesseract(Python + Tesseract)
- EasyOCR(Python,支持多语言)
- PaddleOCR(Python,适用于亚洲语言)
局限性
- 无法保证 100% 的准确率
- 手写文本的识别准确率较低
- 过小的文本可能无法良好提取
- 装饰性字体难以识别
- 背景图像会降低质量
- 无法读取复杂图形中的文本
- 页数越多,处理时间越长
评论
支持 Markdown