Pdf last page footer

in the invoice (even in quote) PDF, actually the total amount (and the taxes) of the invoice are placed in the footer of the document for having it at the bottom of the page.
But when i have multiple pages, i would like to display the total amount only in the footer of the last page.

Is there a possibility to change the working method of mpdf so i can discriminate if the footer to be print is (or not) the last page footer?
Or if possible, to print the total amount only at the bottom of the last page?

thanks in advance,
Massimiliano.