This post shows how to create a jasper report using iReport that displays page numbers and page count, e.g., 1/10. Moreover, the iReport will show the page numbers and page count on top of the pages.
iReport 2.0.0 and other requirements
We used the following items for this post.
- Windows 7 Professional SP1
- Eclipse – Kepler Release
- Java 1.7 (1.7.0_67 – Windows x86)
- NOTE: Set source target and level is Java 1.6
- We have not tested it yet with source target and level 1.7
- JasperReport 3.1.4
- iReport 2.0
Using iReport 2.0 To Display Page Numbers and Count
iReport 2.0.0 is ancient, but it serves its purpose, at least, in the application I maintain. It is so old I started to think I was hitting an unresolved bug while struggling to generate the correct page numbers and count. But I was wrong.
To generate something like “1 / 2″, i. e., page one of two pages, use only $V{PAGE_NUMBER} for each number evaluated at Page Time and Report Time.
Notice the report we generated using iReport – it displays the current page and the total page count.
This is also, of course, applicable to later versions of iReports.