0

iReport 2.0.0 Page Number and Page Count

Background

This article demonstrates how to create a jasper report that displays page number and page count , e.g., 1/10.

Software Environment

  • 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

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 correct page number 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

 

ireport2-0-0_page_number_sample01

Sample generated PDF

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