[reportlab-users] Using images in body of rlzope.py example

Everett, H. Chris H.CHRIS.EVERETT at saic.com
Wed Mar 28 13:02:25 EDT 2007


I am using rlzope.py as the basis for a report generator, and I want to
take an image from the Zope database and use it in the body of the
report, not the template (the image will be different for each instance
of the report. Rlzope.py fetches an image for use by the MyPageTemplate
class:

class MyPageTemplate(PageTemplate) :
"""Our own page template."""
def __init__(self, parent) :
...
self.logo = self.getImageFromZODB("logo")

def getImageFromZODB(self, name) :
"""Retrieves an Image from the ZODB, converts it to PIL,
and makes it 0.75 inch high.
"""
try :
# try to get it from ZODB
logo = getattr(self.parent.context, name)
except AttributeError :
# not found !
return None

However, I haven't been able to successfully modify this for use in the
MyPDFDoc class. Can anyone help?


More information about the reportlab-users mailing list