Add Page Numbers Using The Template Editor

To insert page numbers in your PDF's header or footer, use the {{!PageNumber}} and {{!PageCount}} merge fields. To do this, go to  Template Editor > Insert Field > Special Merge Fields.