Created
July 24, 2013 11:56
-
-
Save saga/6069897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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