Java, Software Development

iReport 2.0.0 Page Numbers and Page Count

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)
    1. NOTE: Set source target and level is Java 1.6
    2. 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.

ireport2-0-0_page_number_page_time1

Evaluate at Page Time

 

ireport2-0-0_page_number_report_time1

Evaluate at Report Time

 

Notice the report we generated using iReport – it displays the current page and the total page count.

ireport2-0-0_page_number_sample01

Sample generated PDF

This is also, of course, applicable to later versions of iReports.

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like