[reportlab-users] A bug using <img>

Roberto Alsina ralsina at netmanagers.com.ar
Sat May 16 17:57:41 EDT 2009

I got this bug report for rst2pdf, but I was able to reproduce it using just


Basically, a paragraph containing <img src="thanks.png"> draws the image above
the previous paragraph. The text is there, but it's under the image.

It should be possible to reproduce with almost any image, but you can get
thanks.png here:

And here is my reportlab program to reproduce it:

from reportlab.platypus import SimpleDocTemplate, Paragraph
from reportlab.lib.styles import getSampleStyleSheet
styles = getSampleStyleSheet()

def go():
doc = SimpleDocTemplate("phello.pdf")
style = styles["Normal"]
p = Paragraph('This should be above the image', style)
p = Paragraph('<img src="thanks.png">', style)
p = Paragraph('This should be below the image', style)


("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) KDE Developer (MFCH)
(_Y_.)' ._ ) `._`. " -.-' http://lateral.netmanagers.com.ar
_..`-'_..-_/ /-'_.' The 6,855th most popular site of Slovenia
(l)-'' ((i).' ((!.' according to alexa.com (27/5/2007)
"Our opponent is an alien starship packed with atomic bombs, I said.
We have a protractor. Okay, I’ll go home and see if I can scrounge up a
ruler and a piece of string." — Neal Stephenson

More information about the reportlab-users mailing list