Dear All.

Does anyone use Geraldo Report?

I am trying to use i follow the how to about web2py and Geraldo 
http://www.geraldoreports.org/docs/tutorial-2.html

But i received a empty pdf.

My code:

controllers/callscltes_pdf.py

def callcltes_pdf():

        from reports import ReportPurchase
        from geraldo.generators import PDFGenerator
        import gluon.contenttype
        import StringIO

        r=int(request.args[0])
        resp = StringIO.StringIO()

        cal = db(db.cdr.accountcode==r).select(orderby=db.cdr.id)
        report = ReportPurchase(queryset=cal)
        report.generate_by(PDFGenerator, filename=resp)

        resp.seek(0)
        response.headers['Content-Type'] = gluon.contenttype.contenttype('.pdf')
        filename = "%s_Purchases.pdf" % (request.env.server_name)
        response.headers['Content-disposition'] = "attachment; filename=\"%s\"" 
% filename
        return resp.read()

 modules/reports.py

from geraldo import Report

class ReportPurchase(Report):
    title = 'Purchases list'
    author = 'John Smith Corporation'

The query (db(db.cdr.accountcode==r).select(orderby=db.cdr.id)) returns 50 
tuples.

I appreciate some idea or help.

Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to