[reportlab-users] newbie help

Anil replicase at gmail.com
Wed Dec 5 23:23:22 EST 2007


Ignore my previous email, I am little bit further now. The problem is,
how do I access the canvas from self.drawTabs() method?

Trying to put a small rectangle isn't working. If I had the canvas
available, I could do canvas.circle or canvas.rect.

Thanks.


def generate(self):
buffer = StringIO()

styles = getSampleStyleSheet()
doc = SimpleDocTemplate(buffer, pagesize = letter)

Story = [ Spacer(1, 2.0*inch) ]
style = styles["Normal"]

Story.append(PageBreak())

tabs = self.drawTabs()
Story.append(tabs)

doc.build(Story,
onFirstPage=self.firstPage,
onLaterPages=self.restPage)

pdf = buffer.getvalue()
buffer.close()
return pdf

def drawTabs(self):
r = Rect(5, 5, 200, 100)
r.fillColor = colors.red
r.strokeColor = colors.green
r.strokeWidth = 3
return r


More information about the reportlab-users mailing list