refactor continues
Python CI / test (push) Successful in 6m35s

This commit is contained in:
2025-11-07 19:26:32 +01:00
parent f72c6015c6
commit b1553f1628
18 changed files with 796 additions and 1433 deletions
+51 -31
View File
@@ -2,48 +2,56 @@
This directory contains example scripts demonstrating the pyWebLayout library.
## EbookReader Examples
## Getting Started Examples
The EbookReader provides a high-level, user-friendly API for building ebook reader applications.
These examples demonstrate the core rendering capabilities of pyWebLayout:
### Quick Start Example
### 01. Simple Page Rendering
**`01_simple_page_rendering.py`** - Introduction to the Page system
**`simple_ereader_example.py`** - Simple example showing basic EbookReader usage:
```bash
python simple_ereader_example.py path/to/book.epub
python 01_simple_page_rendering.py
```
This demonstrates:
- Loading an EPUB file
- Rendering pages to images
- Basic navigation (next/previous page)
- Saving positions
- Chapter navigation
- Font size adjustment
Demonstrates:
- Creating pages with different styles
- Setting borders, padding, and backgrounds
- Understanding page layout structure
- Basic rendering to images
### Comprehensive Demo
![Page Rendering Example](../docs/images/example_01_page_rendering.png)
### 02. Text and Layout
**`02_text_and_layout.py`** - HTML parsing and text rendering
**`ereader_demo.py`** - Full feature demonstration:
```bash
python ereader_demo.py path/to/book.epub
python 02_text_and_layout.py
```
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
Demonstrates:
- Parsing HTML content
- Text alignment options
- Font sizes and styles
- Document structure
![Text and Layout Example](../docs/images/example_02_text_and_layout.png)
### 03. Page Layouts
**`03_page_layouts.py`** - Different page configurations
**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
python 03_page_layouts.py
```
## Other Examples
Demonstrates:
- Various page sizes (portrait, landscape, square)
- Different aspect ratios
- Border and padding variations
- Color schemes
![Page Layouts Example](../docs/images/example_03_page_layouts.png)
## Advanced Examples
### HTML Rendering
@@ -51,16 +59,28 @@ 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`.
## Documentation
## Running the Examples
All examples can be run directly from the examples directory:
```bash
cd examples
python 01_simple_page_rendering.py
python 02_text_and_layout.py
python 03_page_layouts.py
```
Output images are saved to the `docs/images/` directory.
## Additional 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)
- `../ARCHITECTURE.md` - Detailed explanation of the Abstract/Concrete architecture
- `../docs/images/` - Rendered example outputs
## Debug/Development Scripts