Forum How do I...?

footer problem


we are using prince to generate invoices online via html & css. but i have the following problem.

In the template ther is a footer that calculates the totals. this footer has to appear on the last page of the document.

but for some reason it places this footer on every page, how do i tell prince to place the footer under the last piece of content.

I tried the @page:first --> no bottom and the @page places the bottom.

but no luck..

Any thoughts?

kind regards


If the document has only two pages then you can use the :first page selector to disable the footer on the first page:
@page { @bottom { content: flow(footer) }
@page:first { @bottom { content: none } }
#footer { flow: static(footer) }

Please note that you need to place the @page:first rule after the @page rule to make it work, due to a bug in Prince.

However, if the document has more than two pages and you only want to show the footer on the last page then the above solution won't work. (There is no :last page selector at the moment). The workaround would be to place the footer template at the end of the source document. (In that case the @page:first rule won't be needed.)

thanks for the replay, that helped, but it isn't exactly giving what i need.

now i have the problem that the footer is really high, whilst it shouldnt be. there is no height defined in the css, but it still does it.

This is very promising, but sometimes frustrating..
I figured it out, turned out that i wasn't vertical aligning with the bottom footer. my mistake.

Everything works now. :D