71 lines
2.2 KiB
Markdown
71 lines
2.2 KiB
Markdown
# Calendar Generator PDF App
|
|
This python application generates a pdf-file based calendar with images and associated texts for each day. It's designed to read images and texts from specified directories and display them in a calendar format. Per DIN A4 page 4 days get displayed.
|
|
|
|
## Setup
|
|
### Prerequisites
|
|
- Python 3.x
|
|
- Basic understanding of Python and Flask
|
|
- reportlab (python modul)
|
|
- os (python modul)
|
|
- re (python modul)
|
|
- textwrap (python modul)
|
|
|
|
|
|
### Installation
|
|
|
|
1. **Clone or Download the Repository**
|
|
|
|
Clone this repository if you're familiar with Git, or simply download it as a ZIP file and extract it.
|
|
|
|
2. **Install Required Packages**
|
|
|
|
reportlab is required and can be installed via pip:
|
|
```bash
|
|
pip install reportlab
|
|
``````
|
|
|
|
### Folder Structure
|
|
Your project directory should be structured as follows:
|
|
|
|
```yaml
|
|
|
|
project_folder/
|
|
│ app.py
|
|
│ README.md
|
|
│
|
|
├───images/
|
|
│ │ 2024-01-15.jpg
|
|
│ │ 2024-01-16.png
|
|
│ ...
|
|
│
|
|
└───texts/
|
|
│ 2024-01-15.txt
|
|
│ 2024-01-16.txt
|
|
...
|
|
```
|
|
- `app.py`: Main python application file.
|
|
- `images/`: Directory for storing calendar images. Images should be named `YYYY-MM-DD.extension`.
|
|
- `texts/`: Directory for storing text files corresponding to each day, named `YYYY-MM-DD.txt`.
|
|
|
|
### Running the Application
|
|
|
|
1. Navigate to the project folder in your command line or terminal.
|
|
2. Execute the Flask application:
|
|
```bash
|
|
python app.py
|
|
``````
|
|
3. "PDF created successfully" shoud appear, then you can access the pdf file which is in the same directory as the script.
|
|
|
|
## How It Works
|
|
- Each day on the calendar can have an image and a text associated with it.
|
|
- Images are read from `images/`, and text files are from `texts/`.
|
|
- Files are matched based on their filenames, formatted as `YYYY-MM-DD`.
|
|
- The calendar is dynamically generated based on available images and texts.
|
|
- If an image or text is not available for a specific day, it will be displayed without that content.
|
|
|
|
## Notes
|
|
|
|
- Text for each day should be concise. Lengthy texts may be truncated in the display to maintain the layout of the calendar.
|
|
|
|
## Copyright and license
|
|
This code is for my very good friend Felix W.. Code copyright 2024 Lorenz B. |