[Zope3-Users] Building PDF files using reportlab, with image objects in Zope3

2006-01-02 Thread Adam Summers

Hi,

I'm trying to build a report using zope3 + reportlab 1.20 that I want to 
contain some images from a container (which in the code below is called 
'item').


Has anyone done this? Can they suggest a technique?

Trying the following:
   images = []
   for docpage in item.values():
   f = tempfile.TemporaryFile()
   f.write(docpage.data)
   width, height = docpage.getImageSize()
   images.append( Image(f, width=width, height=height) )


Only gets me as far as an error (when the images list is placed on the 
list containing the document structure):
 File /home/Adam/z3/Zope3/src/zope/component/site.py, line 75, in 
queryMultiAdapter

   default)
 File /home/Adam/z3/Zope3/src/zope/interface/adapter.py, line 475, in 
queryMultiAdapter

   return factory(*objects)
 File /home/Adam/z3/products/ccard/pdf/card.py, line 58, in __init__
   images.append( Image(f, width=width, height=height) )
 File 
/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py, line 
318, in __init__

   self._setup(width,height,kind,0)
 File 
/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py, line 
327, in _setup

   if lazy=0: self._setup_inner()
 File 
/usr/lib/python2.4/site-packages/reportlab/platypus/flowables.py, line 
334, in _setup_inner

   if img: self.imageWidth, self.imageHeight = img.getSize()
 File /usr/lib/python2.4/site-packages/reportlab/lib/utils.py, line 
530, in getSize

   if (self._width is None or self._height is None):
AttributeError: ImageReader instance has no attribute '_width'

  Has anyone done what I want to? How? Any help would be much 
appreciated.


Regards,
Adam


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Building PDF files using reportlab, with image objects in Zope3

2006-01-02 Thread Andreas Jung



--On 3. Januar 2006 11:30:25 +0800 Adam Summers [EMAIL PROTECTED] wrote:



530, in getSize
if (self._width is None or self._height is None):
AttributeError: ImageReader instance has no attribute '_width'

   Has anyone done what I want to? How? Any help would be much
appreciated.



Reportlab questions should be asked on the reportlab mailinglist. This is 
basically not a Zope 3 issue.


-aj

pgpDRE2GcsjLv.pgp
Description: PGP signature
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users