PDF Processing Pro
Verifiedby davila7 · Updated Apr 16, 2026
Production-ready PDF processing with forms, tables, OCR, validation, and batch operations. Use when working with complex PDF workflows in production environments, processing large volumes of PDFs, or requiring robust error handling and validation.
See It In Action
Let me explore the working directory to understand what we're working with.
Now let me look at the PDFs and install dependencies.
Let me analyze the form fields and check the field name mapping between the PDF and our JSON data.
Good. The conda Python has both libraries. Let me run the scripts with that.
The form fields map 1:1 with the JSON keys. Let me check the rate card extraction result and then fill the form.
The table extractor didn't detect tables in the rate card (the text layout doesn't have grid lines for pdfplumber). Let me extract the text directly and parse it.
Good - the form was filled (the /AP warning is cosmetic - appearance streams, not data loss). Now let me fix the extract_tables.py text parser to handle this rate card format, and then parse it properly.
Regex isn't matching — the spacing in the PDF text is different. Let me debug.
Single spaces throughout. Need to adjust the regex to not require \s{2,}.
All 12 items extracted. Now let me validate both outputs.
Two fields didn't get filled (insurance_verified and signature_date). This is a known pypdf quirk with certain field types. Let me fix the fill script to handle these edge cases.
Both missed fields patched. Let me verify the final result.
All done. Here's the summary:
Vendor Packet -- vendor_packet_filled.pdf
- All 13/13 form fields filled from
vendor_answers.json - PDF validated: no errors, no warnings
- Vendor: Meridian Supply Co. | EIN: 47-8823156 | Terms: Net 30 | W-9 + Insurance: confirmed
Rate Card Prices -- rate_card_prices.json
- 12 line items extracted from the scanned rate card:
| Code | Item | Unit | Price |
|---|---|---|---|
| MS-1001 | Industrial Solvent Type A | Gallon | $42.50 |
| MS-1002 | Industrial Solvent Type B | Gallon | $38.75 |
| MS-1003 | Degreaser Concentrate | Liter | $28.00 |
| MS-2001 | Nitrile Gloves (Box/100) | Box | $18.95 |
| MS-2002 | Safety Goggles ANSI Z87 | Each | $12.50 |
| MS-2003 | Respirator Cartridge N95 | Pack/10 | $45.00 |
| MS-3001 | Absorbent Pads Heavy Duty | Case | $67.80 |
| MS-3002 | Spill Kit 30 Gallon | Each | $189.00 |
| MS-3003 | Disposal Drum 55 Gal | Each | $95.50 |
| MS-4001 | PPE Storage Cabinet | Each | $425.00 |
| MS-4002 | Safety Shower Station | Each | $1,250.00 |
| MS-4003 | Eye Wash Station | Each | $385.00 |
- Volume discounts: 5% (10-49), 10% (50-99), 15% (100+)
- Min order: $250 | FOB Origin
I also fixed a bug in scripts/fill_form.py where pypdf's update_page_form_field_values was silently skipping certain fields -- added a fallback that directly patches missed AcroForm field objects.
External Tools
| Tool | Type |
|---|---|
| tesseract | binary |
| pip | binary |
Permissions
| Scope | Description |
|---|---|
| filesystem:read | |
| filesystem:write | |
| process:spawn |
SKILL.md
PDF Processing Pro
Production-ready PDF processing toolkit with pre-built scripts, comprehensive error handling, and support for complex workflows.
Quick start
Extract text from PDF
import pdfplumber
with pdfplumber.open("document.pdf") as pdf:
text = pdf.pages[0].extract_text()
print(text)
Analyze PDF form (using included script)
python scripts/analyze_form.py input.pdf --output fields.json
# Returns: JSON with all form fields, types, and positions
Fill PDF form with validation
python scripts/fill_form.py input.pdf data.json output.pdf
# Validates all fields before filling, includes error reporting
Extract tables from PDF
python scripts/extract_tables.py report.pdf --output tables.csv
# Extracts all tables with automatic column detection
Features
✅ Production-ready scripts
All scripts include:
- Error handling: Graceful failures with detailed error messages
- Validation: Input validation and type checking
- Logging: Configurable logging with timestamps
- Type hints: Full type annotations for IDE support
- CLI interface:
--helpflag for all scripts - Exit codes: Proper exit codes for automation
✅ Comprehensive workflows
- PDF Forms: Complete form processing pipeline
- Table Extraction: Advanced table detection and extraction
- OCR Processing: Scanned PDF text extraction
- Batch Operations: Process multiple PDFs efficiently
- Validation: Pre and post-processing validation
Advanced topics
PDF Form Processing
For complete form workflows including:
- Field analysis and detection
- Dynamic form filling
- Validation rules
- Multi-page forms
- Checkbox and radio button handling
See FORMS.md
Table Extraction
For complex table extraction:
- Multi-page tables
- Merged cells
- Nested tables
- Custom table detection
- Export to CSV/Excel
See TABLES.md
OCR Processing
For scanned PDFs and image-based documents:
- Tesseract integration
- Language support
- Image preprocessing
- Confidence scoring
- Batch OCR
See OCR.md
Included scripts
Form processing
analyze_form.py - Extract form field information
python scripts/analyze_form.py input.pdf [--output fields.json] [--verbose]
fill_form.py - Fill PDF forms with data
python scripts/fill_form.py input.pdf data.json output.pdf [--validate]
validate_form.py - Validate form data before filling
python scripts/validate_form.py data.json schema.json
Table extraction
extract_tables.py - Extract tables to CSV/Excel
python scripts/extract_tables.py input.pdf [--output tables.csv] [--format csv|excel]
Text extraction
extract_text.py - Extract text with formatting preservation
python scripts/extract_text.py input.pdf [--output text.txt] [--preserve-formatting]
Utilities
merge_pdfs.py - Merge multiple PDFs
python scripts/merge_pdfs.py file1.pdf file2.pdf file3.pdf --output merged.pdf
split_pdf.py - Split PDF into individual pages
python scripts/split_pdf.py input.pdf --output-dir pages/
validate_pdf.py - Validate PDF integrity
python scripts/validate_pdf.py input.pdf
Common workflows
Workflow 1: Process form submissions
# 1. Analyze form structure
python scripts/analyze_form.py template.pdf --output schema.json
# 2. Validate submission data
python scripts/validate_form.py submission.json schema.json
# 3. Fill form
python scripts/fill_form.py template.pdf submission.json completed.pdf
# 4. Validate output
python scripts/validate_pdf.py completed.pdf
Workflow 2: Extract data from reports
# 1. Extract tables
python scripts/extract_tables.py monthly_report.pdf --output data.csv
# 2. Extract text for analysis
python scripts/extract_text.py monthly_report.pdf --output report.txt
Workflow 3: Batch processing
import glob
from pathlib import Path
import subprocess
# Process all PDFs in directory
for pdf_file in glob.glob("invoices/*.pdf"):
output_file = Path("processed") / Path(pdf_file).name
result = subprocess.run([
"python", "scripts/extract_text.py",
pdf_file,
"--output", str(output_file)
], capture_output=True)
if result.returncode == 0:
print(f"✓ Processed: {pdf_file}")
else:
print(f"✗ Failed: {pdf_file} - {result.stderr}")
Error handling
All scripts follow consistent error patterns:
# Exit codes
# 0 - Success
# 1 - File not found
# 2 - Invalid input
# 3 - Processing error
# 4 - Validation error
# Example usage in automation
result = subprocess.run(["python", "scripts/fill_form.py", ...])
if result.returncode == 0:
print("Success")
elif result.returncode == 4:
print("Validation failed - check input data")
else:
print(f"Error occurred: {result.returncode}")
Dependencies
All scripts require:
pip install pdfplumber pypdf pillow pytesseract pandas
Optional for OCR:
# Install tesseract-ocr system package
# macOS: brew install tesseract
# Ubuntu: apt-get install tesseract-ocr
# Windows: Download from GitHub releases
Performance tips
- Use batch processing for multiple PDFs
- Enable multiprocessing with
--parallelflag (where supported) - Cache extracted data to avoid re-processing
- Validate inputs early to fail fast
- Use streaming for large PDFs (>50MB)
Best practices
- Always validate inputs before processing
- Use try-except in custom scripts
- Log all operations for debugging
- Test with sample PDFs before production
- Set timeouts for long-running operations
- Check exit codes in automation
- Backup originals before modification
Troubleshooting
Common issues
"Module not found" errors:
pip install -r requirements.txt
Tesseract not found:
# Install tesseract system package (see Dependencies)
Memory errors with large PDFs:
# Process page by page instead of loading entire PDF
with pdfplumber.open("large.pdf") as pdf:
for page in pdf.pages:
text = page.extract_text()
# Process page immediately
Permission errors:
chmod +x scripts/*.py
Getting help
All scripts support --help:
python scripts/analyze_form.py --help
python scripts/extract_tables.py --help
For detailed documentation on specific topics, see:
FAQ
What does PDF Processing Pro do?
Production-ready PDF processing with forms, tables, OCR, validation, and batch operations. Use when working with complex PDF workflows in production environments, processing large volumes of PDFs, or requiring robust error handling and validation.
When should I use PDF Processing Pro?
Use it when you need a repeatable workflow that produces source code, text report, code diff.
What does PDF Processing Pro output?
In the evaluated run it produced source code, text report, code diff.
How do I install or invoke PDF Processing Pro?
npx skills add https://github.com/davila7/claude-code-templates --skill pdf-processing-pro
Which agents does PDF Processing Pro support?
Claude Code
What tools, channels, or permissions does PDF Processing Pro need?
It uses tesseract, pip; channels commonly include code, text, diff, pdf; permissions include filesystem:read, filesystem:write, process:spawn.
Is PDF Processing Pro safe to install?
Static analysis marked this skill as medium risk; review side effects and permissions before enabling it.
How is PDF Processing Pro different from an MCP or plugin?
A skill packages instructions and workflow conventions; tools, MCP servers, and plugins are dependencies the skill may call during execution.
Does PDF Processing Pro outperform not using a skill?
About PDF Processing Pro
When to use PDF Processing Pro
When you need to extract text or tables from PDFs at scale with scripted workflows. When you need to analyze, validate, and fill PDF forms programmatically. When you need OCR support for scanned or image-based PDF documents.
When PDF Processing Pro is not the right choice
When you only need simple manual PDF viewing or one-off edits without automation. When the environment cannot run Python scripts or install OCR dependencies.
What it produces
Produces source code, text report and code diff.
Install
npx skills add https://github.com/davila7/claude-code-templates --skill pdf-processing-proInvoke: Ask Claude Code to use PDF Processing Pro for the task.