Hi everyone,
I am using a custom print format, and if we have multiple pages, I only want the footer to appear at the bottom of the last page.
When I use code below the footer appears on every page
<div id=“footer-html” class=“visible-pdf”>
{% if not no_letterhead and footer %}
{{footer}}
{% endif %}
</div>
and if I write the footer directly it appears right after the content and there is an empty area after it.
Thank you all
when html page is rendered the footer will show up at the end of the html page but when it is converted to pdf whole page will divided into multiple A4 pages, that is why the footer doesn’t appear at the bottom of the last page.
I used the code below from this question to solve the problem
<div id=“footer-html” class=“visible-pdf”>
<script>
window.onload = function() {
var vars = {};
var x = document.location.search.substring(1).split(‘&’);
for (var i in x) {
var z = x[i].split(‘=’, 2);
vars[z[0]] = unescape(z[1]);
}
//if current page number == last page number
if (vars[‘page’] == vars[‘topage’]) {
document.querySelectorAll(‘.extra’)[0].innerHTML = ‘’; //footer content
}
};
</script>
<div class=“extra”>
</div>