Forum How do I...?

avoid page breaks without losing the footer

Cuberic
I have template that has a dynamic height, so I never know if the content will span 1 page or 2 pages. My problem is when the content is longer than 1 page it will break where the footer should be, but the footer will be pushed to the next page and the content will be split indiscriminately and continue on the 2nd page.

I tried wrapping each section in a div and apply page-break-inside:avoid;
This would stop the page break sperating the title and content, but my footer will disappear. Also there will be an extra blank page for some reason.

Is there a way to add a footer to the very last page if you don't know how many pages there will be?
  1. after.pdf96.4 kB
    Here is what happens after I try to fix the page break
  2. before.pdf94.9 kB
    Here is the initial problem.