[reportlab-users] Printing Tuples From A List

Tim Roberts timr at probo.com
Wed Oct 10 21:57:35 EDT 2007


Rich Shepard wrote:

> I'm trying to learn ReportLab to produce the three types of reports we

> need to have our model provide. Of the three, the simplest is a good

> place

> to start.

>

> I've re-read the doc, and tried working directly with the canvas rather

> than using Platypus, but generate neither Python errors nor the specified

> .pdf file.


I don't think the tabbing came out right, because this file wouldn't run
as-is. Here are some of the problems:

def outDo(c):
c = canvas

You pass in a canvas to outDo, and then the first thing you do is erase
it. "c=canvas" is going to wipe out the canvas object you passed in,
and replace it with the class called "canvas". You should get right of
that line.

textobject = c.beginText()
textovject.setFont("Helvetica", 10)

That's misspelled.

textobject.setTextOrigin(0*inch, 9.0*inch)
for pair in EcoPairs:
textobject.textLines(pair)
c.drawText(textobject)

c = canvas.Canvas("EcoPairs.pdf", pagesize=letter)
"""
outDo(c)

c.showPage()
c.save()
"""

The lines starting at the canvas creation should all be in column one,
not indented:

c = canvas.Canvas("EcoPairs.pdf", pagesize=letter)
outDo( c )
c.showPage()
c.save()

Other than that, the basic concept looks OK.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list