Use Jinja2 template language to generate html, and webkit engine to print pdf.