[reportlab-users] PageTemplate's onPageEnd

Tim Roberts timr at probo.com
Thu Aug 4 12:27:49 EDT 2005


On Thu, 4 Aug 2005 17:09:00 +0200 (CEST), Nicholas Wieland 
<nicholas_wieland at yahoo.it> wrote:

>Hi *,
>I'm trying to draw a footer on my pages, and want to implement it with the onPageEnd function of PageTemplates.
> 
>def pageFooter (canvas, document):
>  canvas.drawString (10, 10, '2')
>
>and
> 
>pb_page = PageTemplate (frames = [pb_header_frame, p_table_frame], onPageEnd=pageFooter)
> 
>Unfortunately, nothing happens.
>I've also tryed document.canv.drawString, but the result is the same.
>I don't really know what problem I'm having, so I'd really appreciate a little help from more experienced Reportlab users, or an example of the usage of onPageEnd.
>  
>

You are relying on whatever graphics state was left in the canvas at the 
end of the page.  Instead, you should saveState and set up whatever font 
you want this to be in.

However, I added your code to one of my projects and it worked for me.  
Now, (10,10) is likely to be in the non-printable margin for most 
printers.  Are you checking this in Acrobat or with a printer?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list