[reportlab-users] Paragraph img tag issue

Donn donn.ingle at gmail.com
Sat Dec 20 03:28:09 EST 2008


Hello,
I got a chance to focus on the issue in my other thread. I used examples.py
and added an img tag.

I cannot get it to draw the image that sits in the same directory that I run
the script from (all from the cli).

I am on Kubuntu and reportlab version: Version: 2.0dfsg-1
I am on Python 2.5

The image was tried as jpg, png and gif. The path as "halo.gif", "./halo.gif"

I hope the problem does not require a newer version of RL since I rely on the
repository version on my server.

Thanks,
\d

Here is the code:
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import inch
styles = getSampleStyleSheet()
def go():
doc = SimpleDocTemplate("phello.pdf")
Story = [Spacer(1,2*inch)]
style = styles["Normal"]
img='<img src="halo.gif" valign="top"/>'
for i in range(2):
bogustext = ("XML tags <i>work!</i>, but not images: %s. see?" % img) *20
p = Paragraph(bogustext, style)
Story.append(p)
Story.append(Spacer(1,0.2*inch))
doc.build(Story)

go()


More information about the reportlab-users mailing list