PDFS from GAE using web2py & pdfcrowd

Recently we used pdfcrowd to print pdfs from several of our applications running on the Google App Engine.

Integration is very straight forward – we use the web2py python framework to run on top of GAE – so these steps reflect that. Also in our example we want our python function to return the content as a pdf file.

  1. Register at pdfcrowd
  2. Download their python client library
  3. Copy the source of the client library to the module directory of your web2py application directory
  4. Use the code snippet example below to initialize and call the pdfcrowd library
def print_observation_formpdfcrowd():

   out = StringIO.StringIO()

   pdfcrowd = local_import('pdfcrowd')

   client = pdfcrowd.Client("username", "apikey")

   # our html to convert
   html='<head></head><body>My HTML Layout</body>'

   client.convertHtml(html, out)

   # prepare PDF to download:

   pdf_file_name = 'evaluation.pdf'


   return out.getvalue()

Online Tools that help us run our business

Here is a list of some of the online tools we use to run Product7.

  • Quickbooks Online – online accounting, timesheet reporting, invoicing, great reports
  • Emyth – the process to build the processes – highly recommended
  • Slicehost – the best hosting provider we’ve found for Ruby on RailsĀ  and Joomla – sadly it is going away eventually – replaced by Rackspace Cloud
  • Google Apps – mail, calendar, phone calls
  • Skype – video and chat conferences
  • Unfuddle – the system we use to manage and plan large distributed software projects
  • Google App Engine – our primary choice for back end server projects
  • Web2Py – python based web application framework
  • github – altnerative to subversion
  • Spotify – millions of songs streaming for free online – stop what you’re doing and go get it now
  • GoToMeeting – online conferencing over the web