A static, dependency-free flipbook website that reads the WONCA EMR Newsletter as a real magazine: A4 cover and back cover shown alone, A3 interior pages shown as full spreads, and every flip turns a single A4 leaf through the centre fold.
Each visible page is one A4 leaf (portrait, 210 × 297). Interior spreads are A3 landscape pages split down the middle into a left and a right leaf, so a full spread always shows a complete A3 page.
view 1: [ Cover ] (A4 alone)
view 2: [ Page 2 | Page 3 ] (one A3 spread)
view 3: [ Page 4 | Page 5 ] (one A3 spread)
...
view 8: [ Back cover ] (A4 alone)
-
Export the newsletter pages as PNGs (A4 portrait pages and A3 landscape spreads both work) into any folder, e.g.
~/Downloads/flipbook. -
Run:
python3 tools/build_pages.py ~/Downloads/flipbookThis splits A3 spreads at the centre, resizes every leaf to 1240 × 1754 (A4 @ 150 dpi), writes them to
img/pages/pNN.jpg, regeneratesimg/cover.png, and rewrites the manifestjs/pages.js. -
Re-scan the pages for QR codes so every code stays clickable:
python3 tools/find_qrcodes.py ~/Downloads/flipbookThis decodes the QR codes on the full-resolution source pages and writes their positions to
js/links.js. Clicking a code in the reader asks for confirmation before opening the link in a new tab. Requires:pip3 install opencv-python-headless pillow(optional:zxing-cpp). -
To offer the PDF download, replace
pdf/magazine.pdf(and adjustpdfPath/fileNameinjs/config.jsif the name changes).
Requires Python 3 with Pillow (pip3 install Pillow).
python3 -m http.server 8000
# open http://127.0.0.1:8000The site is fully static — any static host works. package.json provides a
serve start command so Railway (Nixpacka) can run it directly:
railway upindex.html page shell
css/style.css styling
js/config.js title, subtitle, PDF download settings
js/pages.js generated list of page images (build_pages.py)
js/app.js flipbook logic
img/pages/ A4 leaf images (p01 … pNN)
pdf/magazine.pdf optional download
tools/build_pages.py image pipeline
vendor/ PageFlip library
←/→,PageUp/PageDown,Space— turn pagesHome/End— cover / back coverF— fullscreen