From 796da461fbbb863baf9b16a255324d2f7c5448b9 Mon Sep 17 00:00:00 2001 From: Gijs Date: Fri, 9 Sep 2022 09:52:26 +0200 Subject: [PATCH] Extended readme a bit. Some example css. --- README.md | 20 +++++++++++++++++++- static/style.css | 17 ++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40dfade..4785a39 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This boilerplate uses Python 3 and the framework [Flask](https://palletsprojects Find information on how to [install python here](https://www.python.org/downloads/) -To install the requirements, move to the directory this readme is located, and then run: +To install the requirements, move to the directory this readme is located in, and then run. Optionally create a virtual environment: `pip install -r requirements.txt` @@ -28,6 +28,24 @@ by running: `whereis pagedjs-cli`. Now you should be able to start the interface with: `./run.sh`. +# Contents of the boilerplate + +- `app.py` the flask webapp, generating the views +- `pagedjs.py` helper functions to run pagedjs-cli from python +- `utils.py` utitilities for generative books +- `templates/index.html` template for the index +- `templates/book.html` template for the book itself +- `static/style.css` css style rules for the index and book (it's possible to split them up, also adjust the templates then) +- `static/pagedjs.interface.css` css style rules provided by paged.js to have a more rich preview in debug mode + +# Usage + +The boilerplate essentially has two views: `index` and `generate`. The `index` shows the homepage and a link to the `generate` function. In this example the generated book is downloaded as a PDF. + +The template `templates/book.html` is used with styles from `static/style.css` to generate the PDF, adjust them to adjust your book. In `app.py` the function generate loads the template, adjust that function to generate context and / or HTML. + +In the [documentation of paged.js](https://pagedjs.org/documentation/) a lot of information on print specific functionality in CSS can be found. + # Deployment Todo diff --git a/static/style.css b/static/style.css index eeb30d2..c7c7f27 100644 --- a/static/style.css +++ b/static/style.css @@ -1,4 +1,19 @@ h1 { text-decoration: underline; break-after: always; -} \ No newline at end of file +} + +/** +@page { + size: 210mm 297mm; + margin: 10mm 5mm; +} + +*/ + +/** +@media print { + h1 { + } +} +*/ \ No newline at end of file