Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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