How to add page numbers in print format that shows in pdf

I want page numbers in footer section of page in print format , that no shows in pdf .
me trying different types of code but new version of frappe they not work, can any one do thatPreformatted text

work in old frappe version code:
<div id="footer-html" class="visible-pdf"> {% if not no_letterhead and footer %} <div class="letter-head-footer"> {{ footer }} </div> {% endif %} <p class="text-center small page-number visible-pdf"> {{ _("Page {0} of {1}").format('<span class="page"></span>', '<span class="topage"></span>') }} </p> </div>

Any Solution for that?