#!/bin/bash # Capturing the wiki page # --------------------------------------------------------------- # the wiki page that you wrote as an argument in the command line, # is stored in this variable WIKIPAGE=$1 echo ">>> making a booklet from the wiki page: $WIKIPAGE" # Turn the HTML page into a PDF with weasyprint # --------------------------------------------------------------- PDFNAME=$(echo "$WIKIPAGE" | tr :/#%{}\&\\\<\>*?/\!\'\"@+\`= _) echo ">>> generating $PDFNAME.pdf (with weasyprint)" weasyprint https://pzwiki.wdka.nl/mediadesign/$WIKIPAGE?action=render --stylesheet booklet-stylesheet.css $PDFNAME.pdf # And turn the PDF into an A5 booklet PDF for printing # --------------------------------------------------------------- # pdfbook2 is part of the texlive-extra-utils package in Debian echo ">>> generating $PDFNAME-book.pdf (with pdfbook2)" pdfbook2 --paper=a4paper --short-edge --no-crop $PDFNAME.pdf