[reportlab-users] Confirming my suspicions

Charlie Clark charlie at begeistert.org
Fri Mar 4 12:35:43 EST 2005


On 2005-03-02 at 18:03:57 [+0100], reportlab-users-request at reportlab.com 
wrote:
> Make two (or more) page templates: one for the first page (call it "first")
> and and one for the subsequent pages (call it "rest").  Early in the
> story, somewhere that would definitely occur one page one,
> put in this:
> 
> 
>    story.append(NextPageTemplate('rest'))
> 
> The next new page that begins will use the name 'rest'.

ah, thanx for that tip.

> reportlab/test/test_platypus_indents.py and
> reportlab/test/test_platypus_leftright.py contain examples of
> template changes.  The output PDFs will go in your temp directory.
> 
> You can also (since a few months back) add a LIST of templates
> so it can do alternating left and right pages for you.  e.g.
>    story.append(NextPageTemplate(['left','right']))
> 
> If you need dynamically adjusted margins for some reason,
> hacking margins on SimpleDocTemplate is highly unlikely to work
> as it's a wrapper which constructs a single 'real' page template object
> with one frame.  If you use BaseDocTemplate, and hack the frame list,
> it might work; but the PageTemplate is reused and not rebuilt each time
> so care is needed.

Yes, I noticed the Frame seems to be set only once so I started work using 
BaseDocTemplate and got something working. Is it correct that I have to call 
handle_nextPageTemplate() in the afterPage() method of the first 
PageTemplate? I didn't quite understand the documentation on whether I 
should call these methods directly.
 
> Hope this helps,

Yes, I'm afraid I'm just a bit dense as I'm not a programmer through and 
through. This library is *fairly* easy to use but you still need a bit more 
practice than I have. Still, I'm reading far more source than I ever have!

Charlie


More information about the reportlab-users mailing list