Custom Print Format and Footer

I want to repeat the footer on every page but some data like total have to print only the last page of the pdf.
I used below code
{% set fpage = “{0}”.format(‘’) %}
{% set epage = “{0}”.format(‘’) %}
but if condation is failed. Always return False for {{fpage == epage}}

thanks in advance

Use this code, it will print footer on every page and total will be on last page of pdf.

<div id="footer-html" class="visible-pdf">
{% if not no_letterhead and footer %}
<div class="letter-head-footer">
	{{ footer }}
{% endif %}