Ask Reuben – June 18, 2025

GRW – Double Sided, Starting on Odd

When printing double-sided, how do I start new sections on new sheets of paper?

Generating a report file, and printing a report are normally two independent activities.  Genero Report Writer (GRW) produces a file, and then this file is either viewed and/or printed on paper.  Within a report file, you cannot dictate how the file is to be printed.  For example if you print a PDF, Word Document, Excel spreadsheet etc, the dialog box that appears has fields for things such as …

  • number of copies
  • color vs gray scale
  • print on both sides of the paper
  • paper tray
  • paper size
  • page orientation

… you can’t typically explicitly influence these from within the report file other than what can be implicitly implied such as the page orientation.

I should clarify that if from GRW you are generating and sending a report directly to a printer (that is not producing a file), you can use the various fgl_report_setPrinter* family of commands to control how the report is printed.   See here for more details on generating and printing direct.

There is one thing however you may need to take into consideration if you think your reports will be physically printed onto both sides of a sheet of paper.  If different sections of the printed report are going to be physically distributed to different people then you want each of these sections to be on a different physical piece of paper, this means that these sections need to start on an odd numbered page.  If a section finishes on an odd numbered page, a blank page needs to be inserted as the next even numbered page so that the next section starts on an odd numbered page, that is the next physical page, not the back side of the current page.

In Genero Report Writer 3.10, two new PXML functions were introduced,  oddPhysicalPage() and evenPhysicalPage().  These are Boolean functions that as the name suggests, return TRUE or FALSE if the physical page is an odd number or an even numbered page respectively.  The technique as listed in this page of the documentation is to add a Vertical Box object and set the Y-size property of this object to this expression …

oddPhysicalPage()?0:max

When the report file is being generated, this has the effect that if this Vertical Box is added to an odd number paged it will have size 0 and so will have no effect.  However if this Vertical Box is added to an even number page it will have the maximum size available and so effectively insert a blank page.

I typically find that you actually have to insert two objects into your report.  Find the main PageRoot in your report and insert another PageRoot as the parent of this object, and then add the Vertical Box as the first child of this PageRoot (or the elder sibling of the PageRoot).



In the screenshot above, PageRoot is what I had to begin with, MiniPage is the PageRoot I have inserted as a parent, and MiniPage1 is the Vertical Box I then added with the Y-size property set to include the expression using the oddPhysicalPage() function.

Practise with OrderReport.4rp or OrderList.4rp from the Tutorials & Samples in Genero Studio.  With the output of OrderReport.4rp, note in the bottom right it has some text Page N of M.  What you should observe is that those Orders that fit on 1 page will have page 1 of 1 on an odd numbered physical page and the next page will be blank.  The order that fits on 2 pages, it will not have a blank page separating it from the next page.