did you try appreport (a web2py plugin) 
https://github.com/lucasdavila/web2py-appreport ?


Il giorno domenica 11 novembre 2012 06:39:21 UTC+1, chris_g ha scritto:
>
>
> 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()
> }}
>
>
>
>

-- 



Reply via email to