Home
cd ../playbooks
File OrganizationIntermediate

Smart OCR Document Scanner

Extract text from images, scanned documents, and handwritten notes in 100+ languages using PaddleOCR.

10 minutes
By communitySource
#ocr#extraction#multilingual#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.

Or install from your terminal:
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.

README.md

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

  1. Provide the image or scanned document
  2. Optionally specify language(s) to detect
  3. 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

  1. Preprocess Images: Improve quality before OCR
  2. Choose Correct Language: Specify language for better accuracy
  3. Handle Multi-column: Process columns separately
  4. Filter Low Confidence: Skip results below threshold
  5. 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

$Related Playbooks

File Organization

PDF to Word Converter

Convert PDF files to editable Word documents using pdf2docx

10 minutes
Intermediate
File Organization

PDF Watermark Tool

Add watermarks, page numbers, headers, and footers to PDFs

10 minutes
Intermediate
File Organization

Project Inventory & Documentation

Analyze project folders to understand what each does, identify tech stacks, and create documented inventories.

10 minutes
Intermediate
File Organization

Photo Organizer by Event

Organize photos by reading EXIF metadata and analyzing content to create Year > Month > Event folder structures automatically.

5 minutes
Beginner
File Organization

Office to Markdown Converter

Convert Office documents to Markdown for version control and AI processing using Microsoft's markitdown.

10 minutes
Advanced
File Organization

PDF Compression Tool

Reduce PDF file size while maintaining acceptable quality

10 minutes
Intermediate
File Organization

Universal PDF Converter

Convert PDF files to and from Word, Excel, Image, and other formats

10 minutes
Intermediate
File Organization

PDF Text & Table Extractor

Extract text, tables, and metadata from PDFs using pdfplumber

10 minutes
Beginner
File Organization

PDF Form Auto-Filler

Fill out PDF forms programmatically and extract form data

10 minutes
Advanced
File Organization

PDF Merge & Split Tool

Combine multiple PDFs or split into separate files

10 minutes
Intermediate
File Organization

PDF OCR Scanner

Extract text from scanned PDFs using optical character recognition

10 minutes
Beginner
File Organization

Recover Lost Code from Claude Code Sessions

Lost code when a Claude Code session ended? A recovery workflow that scans the session files in ~/.claude/, finds the code Claude wrote by date or keyword, and re-applies it to your project.

5 minutes
Beginner

Browse all File Organization playbooks →