It's child easy, but not googleable yet. I used reportlab - a handy, pure-python pdf library. Here are the steps:
- Checkout reportlab into your app directory
svn co http://www.reportlab.co.uk/svn/public/reportlab/trunk \
- Write some pdf-generation code, like
The key is the canvas instantiation. The constructor takes a file-like object and writes into it. You might have noticed that the code is heavily inspired by this tutorial. The only difference is the creation of canvas.
from google.appengine.ext import webapp
from reportlab.pdfgen import canvas
self.response.headers['Content-Type'] = 'application/pdf'
p = canvas.Canvas(self.response.out)
p.drawString(100, 750, "Hey, it's easy!.")
application = webapp.WSGIApplication([('/', MainPage)], debug=True)
if __name__ == "__main__":
- That's it. See? I said it was easy. You can run the dev_appserver or upload it to Google in order to see the results.