Are you fetching the .pdf url? I don't kwnow how pyfpdf_from_html is coded, but I think you should debug your controller to see what is happening.
Best regards Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Fri, Apr 26, 2013 at 6:06 PM, Jurgis Pralgauskis <[email protected]> wrote: > the problem seems to be with view > > as from controller directly it generates OK > > def pdftest2(): > tags = content() > if request.extension=="pdf": > from gluon.contrib.generics import pyfpdf_from_html > return pyfpdf_from_html(tags ) > return tags > > def pdftest3(): > return content() # this should use generic.pdf when called with .pdf > extension > > > {{ # generic.pdf > from gluon.contrib.generics import pyfpdf_from_html > =pyfpdf_from_html(response._vars) > }} > > > any ideas? > > > 2013 m. balandis 25 d., ketvirtadienis 01:48:28 UTC+3, Jurgis Pralgauskis > rašė: >> >> Hi >> >> >> the code from pypdf wiki examples works >> http://code.google.com/p/pyfpdf/wiki/Web2Py >> (downloaded via http://pyfpdf.googlecode.com/files/web2py.app.fpdf.w2p ) >> >> pdf=MyFPDF() >> pdf.add_page() >> pdf.write_html(str(XML(table, sanitize=False))) >> response.headers['Content-Type']='application/pdf' >> return pdf.output(dest='S') >> >> >> but pyfpdf_from_html(...) gives just html code (with .pdf extension) -- no >> conversion to pdf?? - why could it be... >> >> https://github.com/globaleaks/web2py/blob/master/gluon/contrib/generics.py#L56 >> >> pdf=MyFPDF() >> pdf.add_page() >> html = sanitize(html, escape=False) #### should have better list of >> allowed tags >> pdf.write_html(html,image_map=image_map) >> return XML(pdf.output(dest='S')) >> >> >> I don't see where it defines >> response.headers['Content-Type']='application/pdf' >> >> and I suspect theres no need to return as XML(..)? >> return XML(pdf.output(dest='S')) >> >> >> tested on pythonanywhere and localy... >> ps.: in generic.pdf I set explicitly pyfpdf_from_html instead of >> pdf_from_html > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

