[reportlab-users] Re: Passing canvas of SimpleDocTemplate as argument

Christoph Zwerschke zwerschke at zuv.uni-heidelberg.de
Mon Mar 13 04:56:04 EST 2006


Rasha Ebo wrote:
> I want to send the arguments to the bookmarks function
 > */by student name/*  and */not by doc/*

The problem is that your myLaterPages() function is called for every 
page when you do the doc.build(), which is probably after you ran 
through the records. A simple solution is something like the following:

doc.title = []

for title in records:
     doc.title.append(title)

doc.build()

And in myLaterPages() you do the following:

def myLaterPages(canvas, doc):
    ...
    title = doc.title.pop()
    ...

Of course you have to make sure that your document will contain exactly 
one page per record.

-- Christoph



More information about the reportlab-users mailing list