Report pages control


I need to customize a payment voucher. The page size is around half page of A4 size paper. Since the body section is dynamic in which mean user may have more than one entry and hence the height will change. Is there a function for me to either check for the total number of pages to be printed and control the page footer to print at the last page only.

I need the page footer to print at last page if the payment voucher entry exceed the first page and continue to next pages.

Please advise whether is this possible.

Thank you

From what I know, it is impossible by standard means to check the total number of pages while running fetch(), the only possible solution known to me is to check the height of a row (and other sections, such as headers and footers), then check the number of records fetched by a query (by test-running queryRun before running the actual queryRun and saving the number of total records) and finally calculating the number of pages by yourself.