[reportlab-users] Drawing things alongside paragraphs

Robin Becker robin at reportlab.com
Fri Dec 19 05:21:51 EST 2008


Tim Roberts wrote:

> Donn wrote:

>> On Thursday, 18 December 2008 20:46:10 Tim Roberts wrote:

>>

>>> The platypus paragraph parser doesn't handle <img> tags.

>>>

>> Not according to the docs, unless I read them wrong. There is a section after

>> the XML tags (like bold, font, etc.) that shows an img tag. If I could get

>> that working it would solve the problem.

>>

>

> Well, I am a version or two behind, so perhaps it was added recently.

>

> If so, then perhaps your real issue is the paths. Remember that your

> ReportLab script is running locally on the server. It doesn't know

> anything about the web. The <img> tag needs to use real file system

> paths, relative to the directory containing the script (if you are

> running CGI). You don't use URLs.

>

Modern ReportLab should be able to handle urls etc etc, but we certainly don't
have the concept of a baseurl.


This works for me with latest code

################################
from reportlab.platypus import Paragraph, SimpleDocTemplate
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
styleSheet = getSampleStyleSheet()
P = Paragraph('This is an Img <img
src="http://www.reportlab.com/media/base/logo_bg.gif"/>',styleSheet['BodyText'])
P.autoLeading = 'max'
doc = SimpleDocTemplate('timg.pdf')
doc.build([P])
################################
--
Robin Becker


More information about the reportlab-users mailing list