122 lines
3.0 KiB
Markdown
122 lines
3.0 KiB
Markdown
# PyWebLayout Examples
|
|
|
|
This directory contains example scripts demonstrating the pyWebLayout library.
|
|
|
|
## Getting Started Examples
|
|
|
|
These examples demonstrate the core rendering capabilities of pyWebLayout:
|
|
|
|
### 01. Simple Page Rendering
|
|
**`01_simple_page_rendering.py`** - Introduction to the Page system
|
|
|
|
```bash
|
|
python 01_simple_page_rendering.py
|
|
```
|
|
|
|
Demonstrates:
|
|
- Creating pages with different styles
|
|
- Setting borders, padding, and backgrounds
|
|
- Understanding page layout structure
|
|
- Basic rendering to images
|
|
|
|

|
|
|
|
### 02. Text and Layout
|
|
**`02_text_and_layout.py`** - HTML parsing and text rendering
|
|
|
|
```bash
|
|
python 02_text_and_layout.py
|
|
```
|
|
|
|
Demonstrates:
|
|
- Parsing HTML content
|
|
- Text alignment options
|
|
- Font sizes and styles
|
|
- Document structure
|
|
|
|

|
|
|
|
### 03. Page Layouts
|
|
**`03_page_layouts.py`** - Different page configurations
|
|
|
|
```bash
|
|
python 03_page_layouts.py
|
|
```
|
|
|
|
Demonstrates:
|
|
- Various page sizes (portrait, landscape, square)
|
|
- Different aspect ratios
|
|
- Border and padding variations
|
|
- Color schemes
|
|
|
|

|
|
|
|
### 04. Table Rendering
|
|
**`04_table_rendering.py`** - HTML table rendering with styling
|
|
|
|
```bash
|
|
python 04_table_rendering.py
|
|
```
|
|
|
|
Demonstrates:
|
|
- Rendering HTML tables
|
|
- Table headers and body rows
|
|
- Cell borders and padding
|
|
- Caption support
|
|
- Custom table styling
|
|
|
|

|
|
|
|
### 05. Tables with Images
|
|
**`05_table_with_images.py`** - Tables containing images and mixed content
|
|
|
|
```bash
|
|
python 05_table_with_images.py
|
|
```
|
|
|
|
Demonstrates:
|
|
- Creating tables programmatically
|
|
- Adding images to table cells
|
|
- Book catalog and product showcase tables
|
|
- Mixed content (images and text) in cells
|
|
- Using cover images from test data
|
|
|
|

|
|
|
|
## Advanced 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_final.py`** - Complete multi-page HTML rendering with headers/footers
|
|
|
|
For detailed information about HTML rendering, see `README_HTML_MULTIPAGE.md`.
|
|
|
|
## 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
|
|
python 04_table_rendering.py
|
|
python 05_table_with_images.py
|
|
```
|
|
|
|
Output images are saved to the `docs/images/` directory.
|
|
|
|
## Additional Documentation
|
|
|
|
- `README_HTML_MULTIPAGE.md` - HTML multi-page rendering guide
|
|
- `../ARCHITECTURE.md` - Detailed explanation of the Abstract/Concrete architecture
|
|
- `../docs/images/` - Rendered example outputs
|
|
|
|
## Debug/Development Scripts
|
|
|
|
Low-level debug and rendering scripts have been moved to the `scripts/` directory.
|