Skip to content

Instantly share code, notes, and snippets.

@saikat
Created November 27, 2009 21:08
Show Gist options
  • Select an option

  • Save saikat/244238 to your computer and use it in GitHub Desktop.

Select an option

Save saikat/244238 to your computer and use it in GitHub Desktop.
def export(request):
project_data = simplejson.loads(request.raw_post_data)
output = PdfFileWriter()
for screen in project_data['screens']:
os.system("echo \"%s\" | wkhtmltopdf -O Landscape - test.pdf" %
(screen['html'].encode("utf-8").replace("\"", "\\\"")))
input = PdfFileReader(file("test.pdf", "rb"))
output.addPage(input.getPage(0))
outputStream = file("output.pdf", "wb")
output.write(outputStream)
outputStream.close()
return {'status_code' : 200,
'body' : {}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment