[reportlab-users] Problem adding image

Jim Steil jim at qlf.com
Fri Apr 27 10:46:42 EDT 2007


Henning von Bargen wrote:

>> From: "Jim Steil" <jim at qlf.com>

>> Subject: [reportlab-users] Problem adding image

>>

>> Hi:

>>

>> I'm having trouble getting an image to consistently display

>> on a report

>> I'm generating. Below are two images. They are both generated using

>> the EXACT same program. One time I called it and the brown-ish image

>> shows up. Then when I immediately call it again, the image

>> doesn't show

>> up. This doesn't happen with any predictable regularity.

>> Sometimes the

>> image is displayed, and sometimes it isn't. It doesn't matter which

>> order I run it, I can't find any pattern to why it sometime

>> displays the

>> image and others, it doesn't. To summarize how I'm building

>> this, this

>> is what I'm doing:

>>

>> 1. Create a table with 2 rows, 1 column and set the heights,

>> backgrounds, borders, etc.

>> 2. Inside, build a drawing using the following code:

>>

>> binDrawing = Drawing(60, 60)

>>

>> binDrawing.add(Rect(19.0,40,60,binDrawHeight,fillColor=colors.white))

>>

>> if bobStatus == 0:

>>

>>

>> binDrawing.add(Image(19.6,40.55,58.85,binLevelHeight,'%s/brown.jpg' %

>> (imagePath)))

>>

>> 3. Inside the table cell, add the heading and the drawing. The

>> listData is the table data that I'm modifying, I create it in a prior

>> step and I just 'update' the data here.

>>

>> listData[headerRow[currentCell]][headerCol[currentCell]] =

>> binHeader

>>

>> listData[drawingRow[currentCell]][drawingCol[currentCell]] =

>> binDrawing

>>

>> I'm really confused as to why it will work sometimes but not others.

>> I've done all kinds of verification to know that it IS definitely

>> finding the image. I've made sure that it isn't a layering

>> issue, that

>> the image exists but is behind the Rectangle that I've added.

>>

>> Is there anyone that has mastered the Graphics package run

>> into anything

>> like this before? Any clues as to where I can go to figure

>> out what is

>> causing this? Any responses would be appreciated. I'm happy to post

>> more code if you think it would help.

>>

>>

>

> I think you should try to narrow it down to a simple, working

> example program (using fiexed data).

> I suspect that there are some side-effects that influence your

> current program (without having seen it).

> For example, is your program multi-threaded? Or is there an error

> at the OS level that is silently ignored by your program?

> I cannot imagine the same program with the same data in the same

> environment/situation to behave differently.

>

> Henning

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

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

>

I too, cannot image that the same program with the same data/environment
would act differently, hence the post. I'm guessing I have something
wrong somewhere, but just can't seem to find it and was hoping someone
might say 'be sure to check .....'. I added the following line of code
yesterday (which really doesn't do anything other than reassure me that
the program can find and load the image) and it seems to be working fine
now. This is probably just a red herring, but I'm really stumped as to
what the real problem might be.

canvas.drawImage('%s/brown.jpg' % (imagePath), 7.0*inch, 0.75*inch,
1, 1)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20070427/88406d6e/attachment.html>


More information about the reportlab-users mailing list