[Zope] Properly intergating reportlab and Zope

ed colmar ecolmar@uswest.net
Mon, 6 Nov 2000 09:12:17 -0700


Hi all!

I'm still trying to get this to work, so I'm going to try the lists for
assistance again.  TIA!!!

I am working on a project using zope and reportlab.

The goal is to have uploaded images end up in a formatted PDF file.

I have both of these halves completed, I need to figure out how to connect
them.

I have been using SquishFile.py as the wrapper around uploaded images, as is
done in squishdot.  The few image types I have tried have displayed fine on
screen, but PIL/Reportlab is not able to recognise the image.  I know how to
get an image into reportlab from the filesystem, but is there a way to use
one that is in the Zodb?

How would you go about wrapping the file in a PIL.Image() ?  I've been
trying things similar to:

        cardimage=PIL.Image.open(self.uploadedimage)
        c.drawInlineImage(cardimage, 1,1)

This gives an error in reportlab.canvas.convert()

I tried using PIL.image.fromstring(), but I can't quite get it to work
out:

        filebytes=[str(self.uploadedimage.file_bytes()), 'bytes']
        cardimage=PIL.Image.fromstring(self.uploadedimage.content_type(),
               filebytes,
               self.uploadedimage.file_data())
        c.drawInlineImage(cardimage, 1,1)

This gives a typeerror: PIL/Image.py, line 848, in new

has anyone succesfully done this?  can I just Leave the SquishFile wrapper
off if it is ONLY going to be images that get uploaded?

Thanks for any ideas!

-ed-


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )