Page Number with groups and overflow


I have a PDF file with grouping by invoice number. When the page overflows I am printing a “Invoice 123 continue” header, instead of the full header. To do this I am resetting the page number in the group properties.

I still need the page numbers to be printed without the reset, so when the group changes, the printed page number is not reset.

I added a variable like this

<variable name="CurrentPageNumber" class="java.lang.Integer" resetType="Master">

                  <variableExpression><![CDATA[$V{CurrentPageNumber} + 1]]></variableExpression>

                  <initialValueExpression><![CDATA[new Integer(0)]]></initialValueExpression>


Now the page number is the same for the first page of the group and all the overflow pages


                  Page 1 prints “Page 1 of 12”

                 Page 2( overflow) prints “Page 1 of 12”

                 Page 3( new group) prints “Page 2 of 12”

And so on.

I need

                  Page 1 prints “Page 1 of 12”

                  Page 2( overflow) prints “Page 2 of 12”

                  Page 3( new group) prints “Page 3 of 12”

And so on.

Trying to understand how to get a value to increment for every physically printed page with all the different evaluation time, resetType, etc settings.

Any help is appreciated's picture
Joined: Oct 27 2015 - 7:33am
Last seen: 1 week 2 days ago

@bigalex. I need to reset the page number to toggle between a full header  ( page number = 1) and a "continue" header  ( page number > 1).

Unless there is another way to toggle the header that prints on the overflow page - 1 week 4 days ago

this worked for me after doing some research.

I declared a varaible like this

<variable name="CurrentPageNumber" class="java.util.concurrent.atomic.AtomicInteger" calculation="System">

            <initialValueExpression><![CDATA[new java.util.concurrent.atomic.AtomicInteger(1)]]></initialValueExpression>


Then enter this for the expression in the footer to print the page number. The method will print the current value then increment it by one

$V{CurrentPageNumber}.getAndIncrement() - 1 week 2 days ago

1 Answer:


If you need the page numbers s to continue -don't  reset group. The variable $P{Page_Number) is available on the Variable list. Field 1 reset-Now "Page " + $V{PAGE_NUMBER}   Field 2 reset-Report ) "   of " + $V{PAGE_NUMBER}

bigalex's picture
Joined: Apr 12 2019 - 9:15am
Last seen: 1 week 13 hours ago