Suppose you want to make an AJAX call that starts a file download. How can you do that? 1. form submission 2. a element href 3. iframe
Too complex! of course *web2py* comes to rescue... BIG NOTE: the following is based on 'data:' url type and was tested only on FF and chrome. I do not have IE but I suppose that is not compatible with the standard! In your view put a web2py ajax call similar to the following wherever you need it: ajax('%s',[],':eval');" % URL('gen_pdf') ex. {{=A(T('be brave!'), _onclick="ajax('%s',[],':eval');" % URL('gen_pdf'), _class='button')}} in the controller use embed64. def gen_pdf(): from gluon.contrib.pyfpdf import FPDF pdf=FPDF() pdf.add_page() pdf.set_font('Arial','B',16) pdf.cell(40,10,'Hello World at %s!' % request.now) doc=pdf.output(dest='S') doc64=embed64(data=doc,extension='application/pdf') return 'window.location="%s";' % doc64 have fun! mic