I am trying to print a webpage in PDF. This PDF will be a few pages long and have a footer that should appear on the last page and stick to the bottom.
The issue is that I can both have the footer appear at the end of each pages or only the first one. But not only on the last one.
I think that I've tried all stackoverflow answers to similar questions but none of them worked.
For example this CSS rule make the footer stick to the bottom of the first page only :
@media print {
.container {
position: absolute;
bottom: 0;
page-break-inside: avoid;
}
}
While this one make the footer appear at the bottom of each pages :
@media print {
.container {
position: fixed;
bottom: 0;
page-break-inside: avoid;
}
}
I have also tried every position possible, none of them worked as I wanted. If it's not possible using only CSS, the other possibility that I've thought about is to place a div between the footer and the last div so that I can, using javascript, calculate the height needed for the footer to be at the bottom. Only problem with that is that I don't know how to it when printing.
PS: I am sorry if my English is a little bit hard to read, I am not really good.