[reportlab-users] Inline images not working..
Brower Jason
Jason.Brower at kone.com
Mon Jul 13 02:19:15 EDT 2009
Starting out with this Reportlab and it's pretty fun so far...
In testing it's capabilities I noticed an issue.
I am trying to insert an inline image and it's not working. The first
works.
But the other image, <img src="../bullet.png"/>, does not.
Any ideas what I am doing wrong here?
Source:
---
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.units import cm
from reportlab.platypus import Paragraph, Frame
from reportlab.lib.pagesizes import landscape, A4
pdf = Canvas("phello.pdf", landscape(pagesize = A4))
styles = getSampleStyleSheet()
styleN = styles['Normal']
styleH = styles['Heading1']
story = []
#add some flowables
story.append(Paragraph("This is Frame 1",styleH))
story.append(Paragraph("This is a in <i>Normal</i> style. This is a
paragraph in <i>Normal</i> style. ", styleN))
story.append(Paragraph("And look! Another in <b>bold</b> style.",
styleN))
pdf.drawImage("template.png", cm*1, cm*1, width=28*cm, height=19*cm)
f = Frame(cm*6.5, cm*1, cm*7, cm*7, showBoundary=1)
f.addFromList(story,pdf)
story.append(Paragraph("This is a Heading",styleH))
story.append(Paragraph('<img src="../bullet.png"/> --<u>image</u>
Another in <b>bold</b> style.<br/>', styleN))
story.append(Paragraph("And look! Another in <b>bold</b> style.",
styleN))
story.append(Paragraph("And look! Another in <b>bold</b> style.",
styleN))
story.append(Paragraph("And look! Another in <b>bold</b> style.",
styleN))
f2 = Frame(cm, cm*10, 6*cm, 9*cm, showBoundary=1)
f2.addFromList(story,pdf)
pdf.save()
---
Any ideas? I have tried absolute path and relative and both so no
changes. It sows not space for it. Do I need to declare width and
height?
Best Regards,
Jason Brower
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20090713/e3e7dc7f/attachment.html>
More information about the reportlab-users
mailing list