Add page number to custom invoice template

Is there a way to add a page number that will increase with each page to a custom invoice template? I can't find any instructions anywhere.