1. Render html (easy with a templating language e.g. Jinja for Python)
2. Turn the html into a pdf (e.g. wkhtmltopdf in Python)