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

Dev Sen DEV.K.SEN at saic.com
Wed Mar 28 13:19:00 EDT 2007


I guess a more general question related to this would be how to replace
"self.getImageFromZODB("logo") with the appropriate path to grab an image
stored on the filesystem dependent on some parameter. For example,
"/path/images/image=RelevantParameterHere". Is that doable?

Dev



On 3/28/07 1:02 PM, "Everett, H. Chris" <H.CHRIS.EVERETT at saic.com> wrote:


> 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?

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users




More information about the reportlab-users mailing list