ron.liftc-e.com Posted October 11, 2021 Share Posted October 11, 2021 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 pagesExample 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 More sharing options...
bigalex Posted October 11, 2021 Share Posted October 11, 2021 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} Link to comment Share on other sites More sharing options...
ron.liftc-e.com Posted October 11, 2021 Author Share Posted October 11, 2021 @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 Link to comment Share on other sites More sharing options...
ron.liftc-e.com Posted October 13, 2021 Author Share Posted October 13, 2021 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now