Smart OCR Document Scanner
Extract text from images, scanned documents, and handwritten notes in 100+ languages using PaddleOCR.
You have stacks of scanned documents, handwritten notes, and photographed whiteboards that need to become searchable, editable text. This playbook extracts text from images and scanned documents in 100+ languages using PaddleOCR with layout-aware processing.
Who it's for: administrative staff digitizing paper archives and scanned document collections, researchers extracting text from photographed book pages and historical documents, multilingual teams processing documents in non-Latin scripts (Chinese, Arabic, Korean), legal professionals converting scanned contracts and filings into searchable text, data entry teams automating form and receipt digitization
Example
"Extract text from 200 scanned invoices for our accounting system" → OCR pipeline: batch image preprocessing (deskew, contrast enhancement, noise removal), PaddleOCR text extraction with layout detection preserving table structures, multilingual text recognition for international invoices, structured output with invoice number, date, amounts, and vendor fields, and CSV export ready for accounting software import
CLAUDE.md Template
New here? 3-minute setup guide → | Already set up? Copy the template below.
npx ccplaybooks add smart-ocr# Smart OCR
## Overview
This workflow enables intelligent text extraction from images and scanned documents using **PaddleOCR** - a leading OCR engine supporting 100+ languages. Extract text from photos, screenshots, scanned PDFs, and handwritten documents with high accuracy.
## How to Use
1. Provide the image or scanned document
2. Optionally specify language(s) to detect
3. I'll extract text with position and confidence data
Get new playbooks like this one
One email a week with new Claude Code workflows. Free, like everything here.
No spam. Unsubscribe anytime.
What This Does
This workflow enables intelligent text extraction from images and scanned documents using PaddleOCR - a leading OCR engine supporting 100+ languages. Extract text from photos, screenshots, scanned PDFs, and handwritten documents with high accuracy.
Quick Start
Step 1: Create a Project Folder
mkdir -p ~/Documents/SmartOcr
Step 2: Download the Template
Click Download above, then:
mv ~/Downloads/CLAUDE.md ~/Documents/SmartOcr/
Step 3: Start Working
cd ~/Documents/SmartOcr
claude
How to Use
- Provide the image or scanned document
- Optionally specify language(s) to detect
- I'll extract text with position and confidence data
Example prompts:
- "Extract all text from this screenshot"
- "OCR this scanned PDF document"
- "Read the text from this business card photo"
- "Extract Chinese and English text from this image"
Best Practices
- Preprocess Images: Improve quality before OCR
- Choose Correct Language: Specify language for better accuracy
- Handle Multi-column: Process columns separately
- Filter Low Confidence: Skip results below threshold
- Batch Processing: Process multiple images efficiently
Examples
Example 1: Business Card Reader
from paddleocr import PaddleOCR
import re
def read_business_card(image_path):
"""Extract contact info from business card."""
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr(image_path)
# Extract all text
all_text = []
for line in result[0]:
all_text.append(line[1][0])
full_text = '\n'.join(all_text)
# Parse contact info
contact = {
'name': None,
'email': None,
'phone': None,
'company': None,
'title': None,
'raw_text': full_text
}
# Email pattern
email_match = re.search(r'[\w\.-]+@[\w\.-]+\.\w+', full_text)
if email_match:
contact['email'] = email_match.group()
# Phone pattern
phone_match = re.search(r'[\+\d][\d\s\-\(\)]{8,}', full_text)
if phone_match:
contact['phone'] = phone_match.group().strip()
# Name is usually the largest/first text
if all_text:
contact['name'] = all_text[0]
return contact
card_info = read_business_card('business_card.jpg')
print(f"Name: {card_info['name']}")
print(f"Email: {card_info['email']}")
print(f"Phone: {card_info['phone']}")
Example 2: Receipt Scanner
from paddleocr import PaddleOCR
import re
def scan_receipt(image_path):
"""Extract items and total from receipt."""
ocr = PaddleOCR(use_angle_cls=True, lang='en')
result = ocr.ocr(image_path)
lines = []
for line in result[0]:
text = line[1][0]
y_pos = line[0][0][1]
lines.append({'text': text, 'y': y_pos})
# Sort by vertical position
lines.sort(key=lambda x: x['y'])
receipt = {
'items': [],
'subtotal': None,
'tax': None,
'total': None
}
for line in lines:
text = line['text']
# Look for total
if 'total' in text.lower():
amount = re.search(r'\$?([\d,]+\.?\d*)', text)
if amount:
if 'sub' in text.lower():
receipt['subtotal'] = float(amount.group(1).replace(',', ''))
else:
receipt['total'] = float(amount.group(1).replace(',', ''))
# Look for tax
elif 'tax' in text.lower():
amount = re.search(r'\$?([\d,]+\.?\d*)', text)
if amount:
receipt['tax'] = float(amount.group(1).replace(',', ''))
# Look for items (line with price)
else:
item_match = re.search(r'(.+?)\s+\$?([\d,]+\.?\d+)$', text)
if item_match:
receipt['items'].append({
'name': item_match.group(1).strip(),
'price': float(item_match.group(2).replace(',', ''))
})
return receipt
receipt_data = scan_receipt('receipt.jpg')
print(f"Items: {len(receipt_data['items'])}")
print(f"Total: ${receipt_data['total']}")
Example 3: Multi-language Document
Limitations
- Handwritten text accuracy varies
- Very small text may not be detected
- Complex backgrounds reduce accuracy
- Rotated text needs angle classification
- GPU recommended for best performance
Installation
# CPU version
pip install paddlepaddle paddleocr
# GPU version (CUDA 11.x)
pip install paddlepaddle-gpu paddleocr
# Additional dependencies
pip install pdf2image Pillow