No description
Find a file
Vadym Samoilenko 928fbd216e Add development mode bypass for localhost authentication
- Add isDevelopmentMode() function to check for localhost
- Allow localhost requests without API key in dev mode
- Enables web interface to work without auth configuration
- Production deployments still require API keys

This allows the web UI to function on localhost:8000 without
requiring developers to configure API keys for local testing.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-02-25 13:32:04 +00:00
docs_req Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
README's Add third-party integration analysis 2025-10-21 09:18:38 -04:00
Test_files Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
tests Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
.env.example Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
.gitignore Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
api.php Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
auth.php Add development mode bypass for localhost authentication 2026-02-25 13:32:04 +00:00
create_test_pdf_with_images.py Add test PDF for visual inspector demo 2025-10-20 16:21:18 -04:00
enterprise_pdf_checker.py Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
ENTERPRISE_ROADMAP.md chore: Remove temporary result and upload files, and add README. 2025-11-29 10:18:04 -05:00
index.html Implement auto-fix functionality with download 2025-10-21 10:17:51 -04:00
logger_config.py Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
pdf_remediation.py Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
pytest.ini Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
README.md chore: Remove temporary result and upload files, and add README. 2025-11-29 10:18:04 -05:00
requirements.txt Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
retry_helper.py Add production readiness: authentication, logging, retry logic, and test suite 2026-02-25 13:26:02 +00:00
screen_reader_simulator_proposal.md Add third-party integration analysis 2025-10-21 09:18:38 -04:00
test_auto_fixed.pdf Implement auto-fix functionality with download 2025-10-21 10:17:51 -04:00
test_env.py Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
test_fixed.pdf Implement auto-fix functionality with download 2025-10-21 10:17:51 -04:00
test_php_env.php Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
test_quick.sh Initial commit: Enterprise PDF Accessibility Checker 2025-10-20 15:50:56 -04:00
test_visual_inspector.pdf Add test PDF for visual inspector demo 2025-10-20 16:21:18 -04:00
test_visual_inspector_remediated.pdf Add veraPDF integration and auto-remediation system 2025-10-21 10:10:32 -04:00

PDF Accessibility Checker - Current State

AI-Powered PDF Accessibility Validation System
Comprehensive WCAG 2.1 compliance checking with enterprise-grade features


📋 What This Application Does

This is a production-ready PDF accessibility checker that validates PDF documents against WCAG 2.1 Level A & AA standards. It combines traditional PDF analysis with cutting-edge AI to achieve approximately 95% automated coverage of accessibility requirements.

Core Capabilities

Automated WCAG Validation - Checks 30+ accessibility criteria
AI-Powered Image Analysis - Uses Anthropic Claude 3.5 Sonnet for alt text validation
OCR & Text Detection - Google Cloud Vision for text-in-images detection
Color Contrast Analysis - WCAG AA/AAA compliance checking
Readability Metrics - Flesch scores and grade-level analysis
Auto-Remediation - Fixes common issues automatically
Visual Inspector - See exactly where issues occur on each page
Three Interfaces - Web UI, REST API, and Command Line


🏗️ System Architecture

Components

┌─────────────────────────────────────────────────────┐
│  Web Interface (index.html)                         │
│  • Drag-and-drop PDF upload                         │
│  • Real-time progress tracking                      │
│  • Visual results dashboard                         │
│  • Issue filtering and navigation                   │
└──────────────────┬──────────────────────────────────┘
                   │
                   ▼
┌─────────────────────────────────────────────────────┐
│  REST API (api.php)                                 │
│  • File upload management                           │
│  • Job queue processing                             │
│  • Result storage and retrieval                     │
│  • Auto-remediation endpoint                        │
└──────────────────┬──────────────────────────────────┘
                   │
                   ▼
┌─────────────────────────────────────────────────────┐
│  Processing Engine (enterprise_pdf_checker.py)      │
│  • PDF structure analysis                           │
│  • Image extraction and AI analysis                 │
│  • Color contrast checking                          │
│  • Readability analysis                             │
│  • Comprehensive reporting                          │
└─────────────────────────────────────────────────────┘
           │                           │
           ▼                           ▼
┌──────────────────┐      ┌──────────────────────────┐
│ External APIs    │      │ Remediation Engine       │
│ • Claude Vision  │      │ (pdf_remediation.py)     │
│ • Google Vision  │      │ • Metadata fixes         │
│ • Document AI    │      │ • Language setting       │
└──────────────────┘      │ • Tagging corrections    │
                          └──────────────────────────┘

File Structure

PDF-Accessibility-checker/
├── enterprise_pdf_checker.py    # Main checker (1,499 lines)
├── pdf_remediation.py           # Auto-fix engine (453 lines)
├── api.php                      # REST API backend (529 lines)
├── index.html                   # Web interface (1,727 lines)
├── requirements.txt             # Python dependencies
├── .env.example                 # Environment configuration template
│
├── uploads/                     # Uploaded PDFs (temporary)
├── results/                     # Check results and metadata
├── .cache/                      # API response cache (cost optimization)
│
├── Test_files/                  # Sample PDFs for testing
│   ├── sample_good.pdf
│   └── sample_poor.pdf
│
└── README's/                    # Extensive documentation (19 files)
    ├── START_HERE.md
    ├── QUICKSTART.md
    ├── ENTERPRISE_README.md
    ├── ARCHITECTURE.md
    ├── WCAG_LIMITATIONS.md
    └── ... (14 more guides)

🚀 Quick Setup Guide

Prerequisites

  • Python 3.8+
  • PHP 7.4+ (for web interface)
  • Tesseract OCR (for text extraction)
  • Poppler (for PDF rendering)
  • API Keys:
    • Anthropic API key (required for AI analysis)
    • Google Cloud credentials (optional, enhances analysis)

Installation (5 Minutes)

# 1. Navigate to project directory
cd /path/to/PDF-Accessibility-checker

# 2. Install Python dependencies
pip3 install -r requirements.txt

# 3. Install system dependencies (macOS)
brew install tesseract poppler

# 4. Configure API keys
cp .env.example .env
nano .env  # Add your Anthropic API key

# 5. Start the web server
php -S localhost:8000

# 6. Open browser
open http://localhost:8000

Alternative: Command Line Usage

# Basic check
python3 enterprise_pdf_checker.py document.pdf

# With output file
python3 enterprise_pdf_checker.py document.pdf --output report.json

# Quick mode (skip AI analysis)
python3 enterprise_pdf_checker.py document.pdf --quick

🎯 Key Features Explained

1. AI-Powered Image Analysis

Uses Anthropic Claude 3.5 Sonnet to analyze every image in the PDF:

  • Validates alt text quality and meaningfulness
  • Detects text embedded in images (WCAG 1.4.5 violation)
  • Identifies color-only information (WCAG 1.4.1)
  • Classifies images as decorative vs. informational
  • Provides specific accessibility recommendations

Cost: ~$0.015 per image (cached for free on repeat checks)

2. Comprehensive WCAG Checks

Automated validation of 30+ criteria including:

  • Document structure and tagging (1.3.1, 4.1.2)
  • Text alternatives for images (1.1.1)
  • Color contrast ratios (1.4.3) - AA/AAA levels
  • Language declaration (3.1.1)
  • Page titles (2.4.2)
  • Link text quality (2.4.4)
  • Form field labels (3.3.2)
  • Reading order (1.3.2)
  • Font embedding (1.4.4)
  • Content readability (3.1.5)

3. Auto-Remediation

Automatically fixes common issues:

  • Missing document title
  • Missing author/subject metadata
  • Language not set
  • Document not marked as tagged
  • Missing bookmarks

Usage:

python3 pdf_remediation.py document.pdf --output fixed.pdf --all

4. Visual Page Inspector

  • Displays PDF pages as images
  • Highlights issue locations with color-coded markers
  • Zoom and pan functionality
  • Click issues to see exact page location
  • Severity-based color coding (Critical/Error/Warning/Info)

5. Smart Caching

  • Caches all API responses by content hash
  • Repeat checks of same document = $0 cost
  • Similar images across documents = cached automatically
  • Reduces typical document cost from $0.10 to $0.00 on re-check

📊 What Gets Checked

Fully Automated (75% of WCAG)

Check WCAG Criterion Description
Document Structure 1.3.1, 4.1.2 PDF tagging and semantic structure
Metadata 2.4.2, 3.1.1 Title, language, author, subject
Text Extractability - Ensures text can be read by screen readers
Font Embedding 1.4.4 Fonts are embedded for consistent rendering
Color Contrast 1.4.3 WCAG AA/AAA compliance (4.5:1, 7:1 ratios)
Form Fields 3.3.2 Labels and descriptions present
Links 2.4.4 Descriptive link text (not "click here")
Reading Order 1.3.2 Logical content sequence

AI-Assisted (20% of WCAG)

Check WCAG Criterion AI Model Description
Alt Text Quality 1.1.1 Claude 3.5 Validates meaningfulness of alt text
Text in Images 1.4.5 Claude + Google Vision Detects text embedded in images
Color-Only Info 1.4.1 Claude 3.5 Identifies information conveyed by color alone
Content Readability 3.1.5 TextBlob Flesch scores, grade level analysis
Image Classification 1.1.1 Claude 3.5 Decorative vs. informational

Requires Manual Review (5% of WCAG)

  • ⚠️ Keyboard navigation and tab order (2.1.1)
  • ⚠️ Focus indicators (2.4.7)
  • ⚠️ Actual screen reader testing
  • ⚠️ Semantic structure quality
  • ⚠️ Real user experience validation

💰 Cost Structure

Per Document Estimate (10 pages, 5 images)

Service Usage Cost
Anthropic Claude 5 images @ $0.015 $0.075
Google Cloud Vision 5 images @ $0.0015 $0.008
Google Document AI (OCR) 10 pages @ $0.0015 $0.015
Total ~$0.10

Monthly Costs by Volume

  • 100 documents/month = $10
  • 500 documents/month = $50
  • 1,000 documents/month = $100
  • 5,000 documents/month = $500

ROI Comparison

Method Cost/Document Time Coverage
This Tool $0.10 2-5 min 95%
Manual Review $100 1-2 hours 100%
Adobe Acrobat Pro $20+ 5-10 min 90%
PAC (Free) $0 3-5 min 75%

Break-even: After 2-3 documents vs. manual review
Time savings: 96% reduction in review time


🔧 Current Limitations

What This Tool CANNOT Do

  1. Full Screen Reader Simulation - Cannot replicate NVDA/JAWS behavior
  2. Keyboard Navigation Testing - Cannot test actual tab order functionality
  3. Real User Testing - Cannot replace human accessibility auditors
  4. PDF Creation - Only validates, doesn't create accessible PDFs
  5. Complex Table Analysis - Limited validation of table structure complexity
  6. Mathematical Content - Cannot validate MathML or equation accessibility

Known Issues

  • Large PDFs (>50MB) - May timeout or require increased PHP limits
  • Scanned PDFs - OCR quality depends on scan quality
  • Complex Layouts - Multi-column layouts may have reading order issues
  • Non-English Content - AI analysis optimized for English
  • Password-Protected PDFs - Cannot analyze encrypted documents

📈 Accessibility Score Calculation

Starting Score: 100 points

Deductions:
- Critical Issue: -25 points each
- Error: -10 points each
- Warning: -5 points each
- Info: -2 points each

Minimum Score: 0

Score Interpretation

Score Grade Meaning
90-100 A Excellent - Minor improvements only
80-89 B Good - Several issues to address
70-79 C Fair - Significant barriers present
60-69 D Poor - Major accessibility issues
0-59 F Critical - Document largely inaccessible

🔌 API Endpoints

Upload PDF

POST /api.php?action=upload
Content-Type: multipart/form-data

Body: pdf (file)

Response:
{
  "success": true,
  "data": {
    "job_id": "pdf_123456",
    "filename": "document.pdf"
  }
}

Start Check

POST /api.php?action=check
Content-Type: application/json

Body:
{
  "job_id": "pdf_123456",
  "quick_mode": false
}

Response:
{
  "success": true,
  "data": {
    "job_id": "pdf_123456",
    "status": "processing"
  }
}

Get Results

GET /api.php?action=result&job_id=pdf_123456

Response:
{
  "success": true,
  "data": {
    "filename": "document.pdf",
    "accessibility_score": 75,
    "severity_counts": {...},
    "issues": [...]
  }
}

Auto-Remediate

POST /api.php?action=remediate
Content-Type: application/json

Body: {"job_id": "pdf_123456"}

Response:
{
  "success": true,
  "data": {
    "remediated_pdf": "pdf_123456_remediated.pdf",
    "fixes_applied": 5,
    "download_url": "api.php?action=download&job_id=pdf_123456&type=remediated"
  }
}

🧪 Testing

Test Files Included

  • Test_files/sample_good.pdf - Well-structured PDF with metadata
  • Test_files/sample_poor.pdf - PDF with multiple accessibility issues

Quick Test

# Test the checker
python3 enterprise_pdf_checker.py Test_files/sample_poor.pdf --output test_result.json

# View results
cat test_result.json | python3 -m json.tool

# Test remediation
python3 pdf_remediation.py Test_files/sample_poor.pdf --output fixed.pdf --all

📚 Documentation

The README's/ folder contains 19 comprehensive guides (140KB+ of documentation):

Essential Reading

  1. START_HERE.md - Package overview and quick start
  2. QUICKSTART.md - 5-minute setup guide
  3. ENTERPRISE_README.md - Complete installation and usage
  4. ARCHITECTURE.md - System design and technical details

Advanced Topics

  1. WCAG_LIMITATIONS.md - What can't be automated
  2. INTEGRATION_GUIDE.md - API integration strategies
  3. IMPLEMENTATION_ROADMAP.md - Step-by-step coding guide
  4. API_QUICK_REFERENCE.md - One-page cheat sheet
  5. MASTER_GUIDE.md - Evolution and best practices

Specialized Guides

  • MAMP_SETUP.md - Local server configuration
  • PROGRESS_DISPLAY_GUIDE.md - Real-time progress implementation
  • TECHNICAL_BACKGROUND.md - Deep dive into accessibility standards
  • screen_reader_simulator_proposal.md - Future enhancement ideas

🔒 Security Considerations

Current Implementation

File type validation (PDF only)
File size limits (50MB default)
API keys in environment variables
Temporary file cleanup
CORS headers configured
Input sanitization in API

Production Recommendations

  • Enable HTTPS (required)
  • Implement rate limiting
  • Add user authentication
  • Set up malware scanning
  • Configure file retention policies
  • Enable audit logging
  • Implement API key rotation

🎯 Use Cases

1. Content Publishing

Check PDFs before publication to ensure accessibility compliance

Validate documents meet Section 508, ADA, WCAG 2.1 requirements

3. Quality Assurance

Integrate into CI/CD pipeline for automated accessibility testing

4. Batch Processing

Audit large document libraries for accessibility issues

5. Remediation Workflow

Identify issues → Auto-fix simple problems → Manual review complex cases


🛠️ Technology Stack

Backend

  • Python 3.8+ - Core processing engine
  • PHP 7.4+ - REST API and web server
  • Tesseract OCR - Text extraction from images
  • Poppler - PDF rendering and conversion

Python Libraries

  • pypdf - PDF parsing and manipulation
  • pdfplumber - Advanced PDF analysis
  • Pillow - Image processing
  • numpy - Numerical computations
  • textblob - Natural language processing
  • anthropic - Claude AI integration
  • google-cloud-vision - Google Vision API
  • google-cloud-documentai - Document AI

Frontend

  • Pure HTML5/CSS3/JavaScript - No frameworks
  • Montserrat Font - Professional typography
  • Responsive Design - Mobile-friendly interface

📞 Support & Resources

Getting Help

  1. Check the extensive documentation in README's/ folder
  2. Review troubleshooting section in ENTERPRISE_README.md
  3. Test with sample PDFs in Test_files/
  4. Verify API keys are properly configured

External Resources


🌟 What Makes This Special

Quality-First Design - Uses best-in-class AI models (Claude, Google)
Production-Ready - Enterprise-grade code and architecture
Complete Package - Nothing else to buy or build
Well-Documented - 140KB+ of comprehensive guides
Cost-Optimized - Smart caching reduces API costs
Three Interfaces - Web, CLI, and REST API
Easy Integration - Simple REST API for existing systems
Proven Technology - Built on industry-standard libraries


📊 Current Status Summary

Aspect Status Notes
Core Functionality Complete All checks implemented
Web Interface Complete Drag-drop, progress, results
REST API Complete All endpoints functional
CLI Complete Full command-line support
AI Integration Complete Claude + Google Vision
Auto-Remediation Complete Fixes common issues
Visual Inspector Complete Page-level issue visualization
Documentation Extensive 19 guides, 140KB+
Testing ⚠️ Basic Sample PDFs provided
Authentication Not Implemented Open access currently
Multi-tenancy Not Implemented Single-user design
Report History Not Implemented No tracking over time

🚀 Quick Start Checklist

  • Install Python 3.8+ and PHP 7.4+
  • Install Tesseract and Poppler
  • Run pip3 install -r requirements.txt
  • Copy .env.example to .env
  • Add Anthropic API key to .env
  • (Optional) Add Google Cloud credentials
  • Start server: php -S localhost:8000
  • Open browser: http://localhost:8000
  • Upload a test PDF
  • Review accessibility report

Estimated setup time: 10 minutes


Built with ❤️ for web accessibility. Making the internet accessible for everyone.