In version 5.4 a new variable TOTAL_PAGE_NO can be used to accomplish this. This variable is a bit different than all other variables which can be evaluated as the records are read. TOTAL_PAGE_NO variable can be evaluated only when the document is closed. Because of that, you cannot enter this variable inside an expression and you should always use it standalone.
So, how do you create an expression like "Page 1 of 10" in your header? You have to split this into two elements:
- an expression for the part that is evaluated as the document is created ("Page 1 of"). In this expression you will use PAGE_NO variable
- a simple TOTAL_PAGE_NO variable inside a cell near the expression
As you see, first cell element is right aligned, while the cell with variable is left aligned. And the pdf result will look like: