A complete web application for designing interactive PDF templates optimized for eβink devices. Features a visual editor, multi-user authentication, public project gallery, and professional PDF generation.
Demo server: https://eink.cgpsmapper.com Tutorial: TUTORIAL.md
β Phase 1 & 2 COMPLETED - Full-featured application with user management
- Device profile system with constraint enforcement
- Coordinate system conversion (top-left β bottom-left)
- PDF rendering with ReportLab (text, checkbox, input, divider)
- Navigation features (destinations, outlines, links)
- Ground truth preview generation with PyMuPDF
- Deterministic PDF builds for testing
- Multi-user authentication with JWT tokens
- Project management with versioning and metadata
- Visual editor with drag-and-drop interface
- Master/Plan system for parametric templates
- Compilation rules for repeated page generation
- Public gallery for sharing templates with the community
- Real-time preview with WebSocket updates
- PDF download and export functionality
- Responsive design optimized for desktop and mobile
- User registration and authentication system
- Project cloning and sharing capabilities
- Version tracking (v0.2.1)
- Donation support integration
- Interactive PDF Creation: PDFs with internal navigation, bookmarks, and links
- Device Optimization: 9 e-ink device profiles with constraint enforcement
- Ground Truth Preview: Pixel-perfect PNG previews matching final PDF output
- Template Validation: YAML-based templates with Pydantic schema validation
- Deterministic Builds: Reproducible PDF generation for testing and version control
- Multi-user Workspace: Individual user accounts with project isolation
- Project Versioning: Track changes and maintain project history
- Master Templates: Create reusable template components
- Plan System: Define parametric template configurations
- Compilation Rules: Generate multiple pages with different data contexts
- Template Sharing: Publish projects to the community gallery
- Project Cloning: One-click duplication of public templates
- PDF Downloads: Direct download of compiled PDFs from gallery
- Usage Tracking: View clone counts and project popularity
- Text Blocks: Styled text with font, size, and color control
- Checkboxes: Interactive checkboxes with labels and touch target optimization
- Text Inputs: Form input fields with labels
- Dividers: Horizontal lines for layout structure
- Boox Note Air 4C: 10.3" E-ink (1872Γ1404, 227 PPI)
- reMarkable 2: 10.3" E-ink (1872Γ1404, 226 PPI)
- Kindle Scribe: 10.2" E-ink (1860Γ2480, 300 PPI)
- Supernote A5X: 10.3" E-ink (1872Γ1404, 227 PPI)
- Supernote A6X: 7.8" E-ink (1872Γ1404, 300 PPI)
- Supernote Manta: 10.3" E-ink (1872Γ1404, 227 PPI)
- Kobo Sage: 8" E-ink (1440Γ1920, 300 PPI)
- Kobo Elipsa 2E: 10.3" E-ink (1872Γ1404, 227 PPI)
- Custom profiles: Easy to add new devices via YAML configuration
- React 18 with TypeScript for type safety
- Vite for fast development and building
- Tailwind CSS for utility-first styling
- Zustand for state management
- React Router for navigation
- Axios for API communication
- React Hook Form for form validation
- FastAPI with Python for high-performance API
- JWT authentication with secure token handling
- ReportLab for PDF generation
- pikepdf for PDF post-processing
- PyMuPDF for preview generation
- Pydantic for data validation
- File-based storage for user data and projects
- Docker containerization with multi-stage builds
- Nginx reverse proxy and static file serving
- WebSocket support for real-time preview updates
- CORS configuration for cross-origin requests
- Docker and Docker Compose installed
- Device profile files in
/config/profiles/(included in repository)
# Clone the repository
git clone https://github.com/stachuman/boox-template-generator.git
cd boox-template-generator
# Build and start the application
docker compose build
docker compose up -d- Frontend:
http://localhost:3000(setFRONTEND_PORTto override) - API: Automatically proxied through Nginx at
/apiand/ws
- Register an account at
http://localhost:3000/register - Create your first project from the dashboard
- Design your template using the visual editor
- Preview and download your PDF
- Share to gallery to contribute to the community
- User data and projects: Docker volume
eink_data - Device profiles: Host directory
/config/profiles/(read-only)
# Frontend
FRONTEND_PORT=3000 # Port for web interface
# Backend Data Storage
EINK_DATA_DIR=/app/backend/data # User data storage directory
EINK_PROFILE_DIR=/app/config/profiles # Device profiles directory
# Cleanup Settings
EINK_CLEANUP_TTL_DAYS=14 # Auto-cleanup after N days (set β€0 to disable)
EINK_CLEANUP_MAX_TEMPLATES=1000 # Maximum templates to keep (optional)
# Security
JWT_SECRET_KEY=your-secret-key # JWT token signing key (auto-generated if not set)Create docker-compose.override.yml for custom configuration:
version: '3.8'
services:
backend:
environment:
- EINK_CLEANUP_TTL_DAYS=30
- JWT_SECRET_KEY=your-custom-secret
frontend:
ports:
- "8080:80" # Custom port mapping# Backend development
python -m venv einkpdf-env
source einkpdf-env/bin/activate # Linux/Mac
# or: .\einkpdf-env\Scripts\activate # Windows
pip install -e .[dev]
uvicorn backend.app.main:app --reload --host 0.0.0.0 --port 8000
# Frontend development (separate terminal)
cd frontend
npm ci
npm run dev # Starts on http://localhost:3000from einkpdf.validation.yaml_validator import parse_yaml_template
from einkpdf.core.renderer import render_template
# Load template
with open("template.yaml", "r") as f:
template = parse_yaml_template(f.read())
# Generate PDF
pdf_bytes = render_template(
template,
profile="Boox-Note-Air-4C",
deterministic=True
)
# Save PDF
with open("output.pdf", "wb") as f:
f.write(pdf_bytes)from einkpdf.core.preview import generate_ground_truth_preview
# Generate PNG preview from PDF bytes
preview_bytes = generate_ground_truth_preview(
pdf_bytes,
page_number=1,
scale=2.0
)
# Save preview
with open("preview.png", "wb") as f:
f.write(preview_bytes)- Registration: Create account with username/email/password
- Authentication: Secure JWT-based login system
- Profile: Manage account settings and view project history
- Create Project: Start with blank template or clone from gallery
- Design Interface: Use visual editor with drag-and-drop widgets
- Master/Plan System: Create parametric templates with variables
- Compilation Rules: Define how pages should be repeated/generated
- Preview & Test: Real-time preview with WebSocket updates
- Export: Download PDF or share to public gallery
- Public Gallery: Browse community-shared templates
- Project Cloning: One-click duplication of public projects
- Usage Tracking: View how many times your templates are used
- Version Control: Track project changes over time
The application uses YAML-based templates for configuration:
schema_version: "1.0"
metadata:
name: "Sample Template"
description: "Basic template example"
profile: "Boox-Note-Air-4C"
canvas:
dimensions:
width: 595.2 # A4 width in points
height: 841.8 # A4 height in points
margins: [72, 72, 72, 72] # 1 inch margins
background: "#FFFFFF"
widgets:
- id: "title"
type: "text_block"
page: 1
content: "Document Title"
position:
x: 72
y: 100
width: 400
height: 30
styling:
font: "Helvetica-Bold"
size: 18
color: "#000000"
properties:
bookmark: "title_section"
navigation:
named_destinations:
- id: "title_section"
page: 1
x: 72
y: 100
fit: "FitH"
outlines:
- title: "Document Title"
dest: "title_section"
level: 1# Capture new golden file
python tools/golden_file_cli.py capture "test_name" "template.yaml" "Boox-Note-Air-4C"
# Validate against golden file
python tools/golden_file_cli.py validate "test_name" "template.yaml" "Boox-Note-Air-4C"
# Run all golden file tests
python tools/golden_file_cli.py run-tests
# List golden files
python tools/golden_file_cli.py listPlace YAML files under /config/profiles on the host. The backend reads from /app/config/profiles (bindβmounted). You can override with EINK_PROFILE_DIR.
- ReportLab Pass: Generate base PDF with widgets and content
- pikepdf Pass: Add navigation features (destinations, outlines, links)
- Deterministic Pass: Fix timestamps and metadata for reproducible builds
- Preview Pass: Generate ground-truth PNG preview with PyMuPDF
- Templates: Top-left origin (0,0 at top-left corner)
- PDF Output: Bottom-left origin (ReportLab standard)
- Automatic Conversion: Seamless transformation between coordinate systems
- PDF Generation: ~2.1KB typical output with navigation
- Preview Generation: ~19.9KB PNG (scale 2.0)
- Real-time Updates: WebSocket-based preview updates <100ms
- Authentication: JWT token-based with secure session management
- Deterministic Builds: 100% reproducible (identical SHA256 hashes)
- Multi-user Support: File-based storage with user isolation
- Device Profiles: 9 supported e-ink devices with easy expansion
- Project Management: Unlimited projects per user
- Gallery System: Community sharing with clone tracking
- Container Ready: Docker deployment with volume persistence
- Application Version: v0.2.1
- API Compatibility: Stable v1 endpoints
- Database Migration: Automatic user data migration support
- Fork the repository on GitHub
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes following the coding standards in
CLAUDE.md - Test your changes thoroughly
- Submit a pull request with a clear description
- Follow the coding standards in
CLAUDE.md - Add tests for new functionality
- Update documentation as needed
- Ensure all existing tests pass
- Bug Reports: GitHub Issues
- Feature Requests: GitHub Discussions
- Tutorial: TUTORIAL.md
This project is free and open source. If you find it useful, consider supporting development:
β Donate: PayPal.me/StachuMan
Your support helps maintain and improve the project for the entire community!
AGPL-3.0-or-later - This project is free software that ensures freedom for all users.
- Repository: https://github.com/stachuman/boox-template-generator
- Demo: https://eink.cgpsmapper.com
- Tutorial: TUTORIAL.md
- Issues: GitHub Issues
Version: v0.2.1 | Built with: React + FastAPI + ReportLab | Optimized for: E-ink devices
