[reportlab-users] page x of y using DocTemplate

Jade Meskill reportlab-users@reportlab.com
10 May 2002 14:08:21 -0700


On Fri, 2002-05-10 at 12:40, Andy Robinson wrote:
> > I am trying to figure out how I can use a form to draw "Page x of y"
> > with y being the last page drawn.  I understand how to create the form,
> > and how to use the forward declaration, but I can't figure out how to
> > tell when I'm on the last page of the document so I can use that page
> > number as y.  Is there anything inside of the DocTemplate that will tell
> > me when I'm on the last page?  Or any other way to get this
> > information.  Once I call doc.build() the form must be created, but the
> > pages haven't been generated yet.  Anybody have a suggestion? 
> 
> In our RML product (which is basically platypus translated into XML tags)
> what we usually do is make the form declaration the very last thing 
> in the 'story' part of the document.  So it gets the page number just 
> once (using a tag we provide).   In Platypus you would need to put some 
> custom flowable class at the end of the story which, when drawn, did not 
> actually draw anything or consume space, but asked the canvas for the page 
> number and then created a tiny little form with 'y' in it.
> 
> Let me know if that makes sense!  My brain is kind of fried from
> a heavy week and I'm sure I could have worded it better :-)
> 

Ah, OK.  This makes sense to me.  I will try this out and post my
results to the list.  Thanks for your help!

--
Jade Meskill <jade.meskill@libertydistribution.com>
Liberty Distribution Company