[reportlab-users] Insert image from url

Graeme Hawker graeme at lutralutra.co.uk
Wed Dec 10 10:05:24 EST 2008


Hi there!

I am trying to insert an image from a url into a pdf. In practice, this
will be a dynamically generated chart (I'm using PHP's jpgraph as this has
scatterplot and windrose functionality), but I'm just trying to test it on
a flat image file (in this case a google icon).

I try:

logo =
Image(urllib2.urlopen('http://images.google.co.uk/intl/en_ALL/images/images_hp.gif'))
story.append(logo)

But I get the error:

addinfourl instance has no attribute 'seek' fileName=<addinfourl at
13242120 whose fp = <socket._fileobject object at 0x01CA31F0>>

I've read somewhere a mention of passing the url contents via a StringIO
object, but am unsure the details of how to do this. Can anyone assist?

Thanks

Graeme


More information about the reportlab-users mailing list