[reportlab-users] understanding PageTemplate and BaseDocTemplate

Igor Stroh reportlab-users@reportlab.com
25 Jul 2003 12:19:37 +0200


Hi there,

I have a small problem: I need to draw a flyleaf (title) page as the
first page of a document. I can't use the PageTemplate that is rendered
for the rest of the pages 'cos it has another layout. I added the
templates using
self.addPageTemplates(LaterPages) # default one
self.addPageTemplates(FirstPage)  # title page

before I call self.build(), I do this:
self.pageTemplates[1].beforeDrawPage = self.createFlyLeaf
where FlyLeaf() is a method that just prints some debug message.
Now if I run the program, the createFlyLeaf() method isn't called. It
seems like all the flowables I have in my document are using the first
PageTemplate (the LaterPages one). I couldn't find any place in the
reportlab libs where I can explicitly define a PageTemplate for a
Flowable (e.g. a FastPara). Could someone point me into the right
direction?
I mean, I could use SimpleDocTemplate instead of BaseDocTemplate, but
I'd like to use a custom canvas for the build() method of
BaseDocTemplate...

TIA,
Igor