[reportlab-users] Appengine - Reportlab (Get Photo from Model)

Martinho Arantes martinhoarantes at gmail.com
Tue Oct 5 04:14:00 EDT 2010


It would be fantastic.
There are many users like me who are having trouble in integrate reportlab
with google app engine.
I am aware that i read in the foruns.

But i think i´m getting close to the solution. I can print to PDF images
from source folder doing this:

image = canvas.ImageReader(StringIO.StringIO(open('myImage.jpg', 'rb').read

> ()))


This piece of code print to PDF myImage.jpg

What i´d like to print was a random image that a user upload. Of course the
code should be different. I´m trying this one:

image = canvas.ImageReader(StringIO.StringIO(image_data)) # image_data
is a raw string containing a JPEG

c.drawImage(image, 0, 0, 144, 144) # Draw it in the bottom left, 2
inches high and 2 inches wide


There´s where i get the error. I changed utils.py

try:
self._width,self._height,c=readJPEGInfo(self.fp)
except:
raise RuntimeError('Imaging Library not available, unable to import
bitmaps only jpegs')
*to this:*
*
*
self._width,self._height,c=readJPEGInfo(self.fp)


2010/10/5 Andy Robinson <andy at reportlab.com>


> On 5 October 2010 08:51, Martinho Arantes <martinhoarantes at gmail.com>

> wrote:

> > Thanks for all your reply,

> > Let me say that i changed utils.py, like Nick Johnson (Google) suggested

> in

> > his

> > blog:

> http://blog.notdot.net/2010/04/Generating-PDFs-on-App-Engine-Python-and-introducing-Mapvelopes

> .

> > Here´s what he posted

>

> I wasn't aware of this. We have never made "AppEngine compatibility"

> an explicit goal, but since we're so close we'll try to get these

> things fixed in the next couple of days. Shame it all came out just

> after the 2.5 release.

>

> - Andy

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

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

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20101005/443476c5/attachment.htm>


More information about the reportlab-users mailing list