Search code examples
google-app-enginepdfwebapp2html2pdfpisa

How to generate a pdf file from a html page in webapp2


I need a code snippet to generate a PDF file from a HTML page that can contain images and some CSS.

I'm using Google AppEngine with Python 2.7 and webapp2 (not Django).

I know this question may deserve a down-vote because it appears I didn't research enough before asking, but I actually did and couldn't find a specific example on how to accomplish this.


Solution

  • GAE provides the conversion API, which has the capability to convert html to PDF (among some others). For an example on how to convert an html with images to PDF see the answer to the question Incomplete Google App Engine Documentation on Conversion API. If you need to include a CSS, then you need to include it in the html.