+51
-31
@@ -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
|
||||

|
||||
|
||||
### 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
|
||||
|
||||

|
||||
|
||||
### 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
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user