I have created a PDF using CFDocument in CFMX7. All of the customers and their associated transactions are pulled out of the database to create one PDF which contains all of the statements to print. I am using CDDocumentItems such as header, footer etc.

The PageNumbering facility in CFDocument is fairly limited. So I create the HTML required for the statements and then everything is displayed within a PDF using CFDocument. Sometimes, a customer's statement spans two or more pages. I would like to create a page number for individual customer's statements. I am trying to put this pagenumber in the header item and trying to reset the page number per customer statement but to no avail.

Please could anyone have a look at the attached source code and point out the error of my ways.