Jump to content
We've recently updated our Privacy Statement, available here ×

Page Number with groups and overflow


ron.liftc-e.com

Recommended Posts

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>

</variable>

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

Example

                  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

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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>

</variable>

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()

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...