[reportlab-users] newbie question

Tim Roberts timr at probo.com
Mon Jun 6 14:11:08 EDT 2005


On Mon, 6 Jun 2005 10:18:06 -0500, MICHAEL A KOLAKOWSKI 
<mkolakowski at unmc.edu> wrote:

>Hi Folks,
>
>I'm new to using ReportLab.  I have a question which I hope will be easy. 
>I'm changing a program to generate a PDF with the same header and footer 
>on each page.  What is a good way of doing this?  The program already uses 
>SimpleDocTemplate.  I thought, perhaps, one could just do this:
>
> doc.build(Story, onFirstPage = myFirstPage, onLaterPages = myFirstPage)
>  
>

Yes, that's the right way.

>Thus, all the pages should use the same function and be formatted as the 
>'first' page.  However, that results in the later pages overwriting the 
>header on the first page.  You can try this out with the examples.py 
>program.  I hope I have explained myself clearly, thanks for help.
>


Are you referring to the "Hello, World" string that gets written on 
every page?  If you want that on the first page but not the rest, as the 
sample does, then you don't really want to use one function for both 
onFirstPage and onLaterPages.  On the other hand, if you want that on 
every page, but don't want the text to overwrite it, then you need to 
adjust the topMargin in your page template so that you don't overwrite it.

That example makes room for the "Hello, World" on the first page by 
starting out with a 2 inch spacer.  Probably not the best example of 
page layout.

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



More information about the reportlab-users mailing list