Has anyone had any luck running Pisa in a web2py view?
I've only had success with using it at the command line:
pisa example.html
--> pisa.pdf
I've tried putting the following in a view, but I am getting an empty
string returned.
{{
import logging
import os
import StringIO
import xhtml2pdf.pisa as pisa
filename = '%s/%s.html' % (request.controller,request.function)
if os.path.exists(os.path.join(request.folder,'views',filename)):
html=response.render(filename)
else:
html=BODY(BEAUTIFY(response._vars)).xml()
pass
result = StringIO.StringIO()
pdf = pisa.CreatePDF(html, result)
=result.read()
}}
--