anbeime/skill / skills/pdf-processing-pro/pdf-processing-pro
pdf-processing-pro
Verified综合办公文员与软件开发工程师当需要批量处理PDF表单、提取表格或进行OCR识别时,使用内置脚本一键完成自动化提取与数据校验,彻底告别繁琐的手动录入,让复杂文档工作流高效、稳健落地。
| File | Kind | Size |
|---|---|---|
| FORMS.md | markdown | 13.7 KB |
| OCR.md | markdown | 2.8 KB |
| SKILL.md | skill md | 7.1 KB |
| TABLES.md | markdown | 14.6 KB |
| scripts/analyze_form.py | script | 8.5 KB |
OCR.md
View on GitHub# PDF OCR Processing Guide
Extract text from scanned PDFs and image-based documents.
## Quick start
```python
import pytesseract
from pdf2image import convert_from_path
from PIL import Image
# Convert PDF to images
images = convert_from_path("scanned.pdf")
# Extract text from each page
for i, image in enumerate(images):
text = pytesseract.image_to_string(image)
print(f"Page {i+1}:\n{text}\n")
```
## Installation
### Install Tesseract
**macOS:**
```bash
brew install tesseract
```
**Ubuntu/Debian:**
```bash
sudo apt-get install tesseract-ocr
```
**Windows:**
Download from: https://github.com/UB-Mannheim/tesseract/wiki
### Install Python packages
```bash
pip install pytesseract pdf2image pillow
```
## Language support
```python
# English (default)
text = pytesseract.image_to_string(image, lang="eng")
# Spanish
text = pytesseract.image_to_string(image, lang="spa")
# Multiple languages
text = pytesseract.image_to_string(image, lang="eng+spa+fra")
```
Install additional languages:
```bash
# macOS
brew install tesseract-lang
# Ubuntu
sudo apt-get install tesseract-ocr-spa tesseract-ocr-fra
```
## Image preprocessing
```python
from PIL import Image, ImageEnhance, ImageFilter
def preprocess_for_ocr(image):
"""Optimize image for better OCR accuracy."""
# Convert to grayscale
image = image.convert("L")
# Increase contrast
enhancer = ImageEnhance.Contrast(image)
image = enhancer.enhance(2.0)
# Denoise
image = image.filter(ImageFilter.MedianFilter())
# Sharpen
image = image.filter(ImageFilter.SHARPEN)
return image
# Usage
image = Image.open("scanned_page.png")
processed = preprocess_for_ocr(image)
text = pytesseract.image_to_string(processed)
```
## Best practices
1. **Preprocess images** for better accuracy
2. **Use appropriate language** models
3. **Batch process** large documents
4. **Cache results** to avoid re-processing
5. **Validate output** - OCR is not 100% accurate
6. **Consider confidence scores** for quality checks
## Production example
```python
import pytesseract
from pdf2image import convert_from_path
from PIL import Image
def ocr_pdf(pdf_path, output_path):
"""OCR PDF and save to text file."""
# Convert to images
images = convert_from_path(pdf_path, dpi=300)
full_text = []
for i, image in enumerate(images, 1):
print(f"Processing page {i}/{len(images)}")
# Preprocess
processed = preprocess_for_ocr(image)
# OCR
text = pytesseract.image_to_string(processed, lang="eng")
full_text.append(f"--- Page {i} ---\n{text}\n")
# Save
with open(output_path, "w", encoding="utf-8") as f:
f.write("\n".join(full_text))
print(f"Saved to {output_path}")
# Usage
ocr_pdf("scanned_document.pdf", "extracted_text.txt")
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |