Skip to content

Instantly share code, notes, and snippets.

@saga
Created July 24, 2013 11:56
Show Gist options
  • Save saga/6069897 to your computer and use it in GitHub Desktop.
Save saga/6069897 to your computer and use it in GitHub Desktop.
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
class PDFHandler(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'application/pdf'
self.response.headers['Content-Disposition'] = 'attachment; filename=my.pdf'
c = canvas.Canvas(self.response.out, pagesize=A4)
c.drawString(100, 100, "Hello world")
c.showPage()
c.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment