2.0 KiB
PyWebLayout Examples
This directory contains example scripts demonstrating the pyWebLayout library.
EbookReader Examples
The EbookReader provides a high-level, user-friendly API for building ebook reader applications.
Quick Start Example
simple_ereader_example.py - Simple example showing basic EbookReader usage:
python simple_ereader_example.py path/to/book.epub
This demonstrates:
- Loading an EPUB file
- Rendering pages to images
- Basic navigation (next/previous page)
- Saving positions
- Chapter navigation
- Font size adjustment
Comprehensive Demo
ereader_demo.py - Full feature demonstration:
python ereader_demo.py path/to/book.epub
This showcases all EbookReader features:
- Page navigation (forward/backward)
- Position save/load with bookmarks
- Chapter navigation (by index or title)
- Font size control
- Line and block spacing adjustments
- Reading progress tracking
- Book information retrieval
Tip: You can use the test EPUB files in tests/data/ for testing:
python simple_ereader_example.py tests/data/test.epub
python ereader_demo.py tests/data/test.epub
Other Examples
HTML Rendering
These examples demonstrate rendering HTML content to multi-page layouts:
html_line_breaking_demo.py - Basic HTML line breaking demonstration
html_multipage_simple.py - Simple single-page HTML rendering
html_multipage_demo.py - Multi-page HTML layout
html_multipage_demo_final.py - Complete multi-page HTML rendering with headers/footers
For detailed information about HTML rendering, see README_HTML_MULTIPAGE.md.
Advanced Topics
recursive_position_demo.py - Demonstrates the recursive position tracking system
Documentation
README_EREADER.md- Detailed EbookReader API documentationREADME_HTML_MULTIPAGE.md- HTML multi-page rendering guidepyWebLayout/layout/README_EREADER_API.md- EbookReader API reference (in source)
Debug/Development Scripts
Low-level debug and rendering scripts have been moved to the scripts/ directory.