I would like to create PDFs on the fly and PYFPDF seems to fill this scope.
However I
Traceback (most recent call last):
File "/Users/xxx/web2py/gluon/restricted.py", line 209, in restricted
exec ccode in environment
File "/Users/xxx/web2py/applications/app/controllers/default.py"
<http://127.0.0.1:8000/admin/edit/solidworks/controllers/default.py>, line 442,
in <module>
File "/Users/xxx/web2py/gluon/globals.py", line 185, in <lambda>
self._caller = lambda f: f()
File "/Users/xxx/web2py/applications/app/controllers/default.py"
<http://127.0.0.1:8000/admin/edit/solidworks/controllers/default.py>, line 345,
in pdf
return f.render('invoice.pdf', dest='S')
File "/Users/xxx/web2py/gluon/contrib/fpdf/template.py", line 114, in render
element = element.copy()
AttributeError: 'Row' object has no attribute 'copy'
My controller
def pdf():
from gluon.contrib.fpdf import Template
import os.path
el =
db(db.pdf_elements.pdf_template_id==1).select(orderby=db.pdf_elements.priority)
f = Template(format="A4", elements=el,
title="", author="", subject="", keywords="")
f.add_page()
f['logo'] = "Test"
f['date'] = "Test"
response.headers['Content-Type']='application/pdf'
return f.render('invoice.pdf', dest='S')
Everything else is per the sample code
here: http://code.google.com/p/pyfpdf/wiki/Templates
Could this be related
to
http://stackoverflow.com/questions/3975376/understanding-dict-copy-shallow-or-deep/3975388#3975388
But Row is an object, not a dict?
--