Annet,

When I explored this a few years ago, I ended up going with an XML
solution called RML (report markup language). This was developed by
the makers of reportlab, but there are also free implemntations of RML
available (such as the z3c implementation.)
Once I had installed rml2pdf developed XML templates, I used a pdf
view like this in order to render my RML to pdf.
RML is very well documented, and I think you will find examples that
are very similar to your requirements.

Chris


{{
    import gluon.contenttype
    import StringIO
    import z3c.rml.rml2pdf as rml2pdf

    resp = StringIO.StringIO()
    rml = response.render('%s/%s.xml' %
(request.controller,request.function))
    filename = '%s.pdf'%request.function
    resp = rml2pdf.parseString(rml, filename=filename) #creates the
pdf
    response.headers['Content-Type'] =
gluon.contenttype.contenttype('.pdf')
    response.headers['Content-disposition'] = "attachment; filename=
\"%s\"" % filename
    response.write(resp.read(), escape=False)
}}

Reply via email to