ReportLab - Frames - Images

Robin Becker robin at NOSPAMreportlab.com
Mon Jan 15 18:30:37 EST 2007


Chuck wrote:
> I have been trying all day to get this to work. My complete code is
> below. I can get my text into the PDF, I can get my image in the PDF.
> What I can't get to work is frames so that the image (logo) appears to
> the right of the text. The image always appears first and then the text
> below on the next line.
> 
> Please help.


you'll get more help at the reportlab users list (see

http://two.pairlist.net/pipermail/reportlab-users/ )

Anyhow I got some output from your script, by making two changes


> *************** CUT ***********************
> from reportlab.pdfgen import *
..........
> 
> 	pdf = SimpleDocTemplate('bill2.pdf', pagesize = letter)
> 
> 	#need a style
> 	normal = ParagraphStyle('normal')
> 
> 	doc.append(Image("pic.jpg", 100, 71))  #Logo
> 
> 	para = Paragraph("Some text1", normal)
> 	doc.append(para)
> 	para = Paragraph("Some text2", normal)
> 	doc.append(para)
> 	para = Paragraph("Some text3", normal)
> 	doc.append(para)
> 	para = Paragraph("Some text4", normal)
> 	doc.append(para)
> 	para = Paragraph(" ", normal)
> 	doc.append(para)
> 	doc.append(HRFlowable(color="black", thickness=3, width="100%"))

change(1)
	doc.append(flowables.HRFlowable(color="black", thickness=3, width="100%"))
> 
> 
> 	pdf.build(doc,bill)

change(2)

	pdf.build(doc)

> 
> run()
> *************************** CUT ***********************************
> 


I also had to change the name of the image to one on my system.

Hope this helps
-- 
Robin Becker



More information about the Python-list mailing list