[reportlab-users] number of pages

Andy Robinson andy at reportlab.com
Tue Jun 28 10:39:58 EDT 2005


Michael Schulz wrote:
> Hi,
> 
> thanks for your replies. Yeah i think i found the old threat about the 
> "x of y pages" but haven't used forms yet and also realized that this 
> seems only to work with BaseDocTemplate not with SimpleDocTemplate. So I 
> would have to switch to BaseDocTemplate?
Yes.  SimpleDocTemplate is a "getting started" tool
> 
> That's what i tried now:
> Create a new derived SimpleDocTemplate and override the _endBuild method 
> (is that possible here?). Add the proposed code snipplet (3) and add the 
> doForm command to the onFirstPage method of the derived SimpleDocTemplate.
> 
> But i get an error:
> 
> KeyError: "forward reference to 'FormXob.pageCount' not resolved upon 
> final formatting"
> 
> which following the source code is raised when the form is not defined 
> upon saving, so i assume the overriding of endBuild hasn't worked. Hmpf!

Did you call the parent class's _endBuild AFTER or BEFORE your own code?
You'd need to do it after, so that your form is defined before
the document gets saved to disk.

Hope this helps,

Andy




More information about the reportlab-users mailing list