pyWebLayout/examples/README.md
Duncan Tourolle 993095caf9
Some checks failed
Python CI / test (push) Failing after 6m22s
Update repo
2025-11-04 19:25:44 +01:00

72 lines
2.0 KiB
Markdown

# 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:
```bash
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:
```bash
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:
```bash
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 documentation
- `README_HTML_MULTIPAGE.md` - HTML multi-page rendering guide
- `pyWebLayout/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.