Following on from my previous blog featuring RTF templates, this blog addresses another issue that was encountered when working with a client who required reports (Invoices, Purchase Orders etc) from Oracle EBS to be printed duplex and in batch. Printing reports duplex as opposed to Simplex throws out an issue where 2 separate invoices can be printed on the front and back page of piece of paper. This causes an issue where the invoices cannot be posted out to clients as there is 2 separate client invoices per piece of paper. For the purpose of this example I created a simple invoice RTF Template using a Template Builder for Word.
See the below screenshot (each number indicates which piece of paper the invoice is on) where the first invoice is fine as it spans 2 sides of paper. However, the 2nd and 3rd invoices share the second piece of paper, as well as the latter half of the third invoice sharing a piece of paper with the 4th invoice.
So how do we resolve this problem? The solution is to insert a blank page if the invoice has an odd number of pages. This is done by forcing each new invoice to start on an even page – inserting a blank page should the next invoice in the batch start on an odd page. For example, if the invoice is 1 sided, a blank will be inserted on side 2. But, if the invoice is 2 sided, then there is no blank page inserted – and the next invoice will start on the next side. The key to this is to define the invoice as a section and not as a group. When printed in batch each new invoice is its own section and a section can be forced to end on an even or odd page. Start the RTF with the syntax: <?for-each@section:G_HEADERS?> End the RTF with the syntax: <?end for-each?> This defines each new invoice as a “section”. Each section can be forced to end on an even page. Which, in turn, forces each new section to start on an odd page. The syntax is: <?section:force-page-count;’end-on-even’?> Note: This can also be reversed to start on an even page, and end on an odd page. The syntax for that would be: <?section:force-page-count;’end-on-odd’?> As you can see from the below PDF screenshot there is a blank page inserted after each invoice, but only if the invoice ends on an odd numbered side. We can see if the below invoices were printed duplex, they would be able to be posted to clients without any issue.
Note: You may encounter issues if within your RTF you have any reference to a group – perhaps in a summation. To get around this, remove the grouping from within the section and the duplex printing issue should be resolved. <?sum (current-group()/XXCF_LINE_VAT_AMOUNT_DISP)?> <?sum (XXCF_LINE_VAT_AMOUNT_DISP)?>