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

Adjust page margins on odd/even pages


zspartan

Recommended Posts

We are trying to use iReport to generate printable reports that have to be hole punched and put into a binder. Therefore, we need to have the margin on odd pages be shifted over to the right of the page, and shifted to the left on even pages.

 

We are struggling to implement this and would appreciate any guidance on the matter possible.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Not 100% on whether you can dynamically adjust report margins at runtime as this si a report setting not a page setting. Don't think possible but maybe someone who is more well versed in iReport/Jasper than I can confirm.

 

One option (hack) would be to double up the objects and/or detail bands and then control which one prints through a printWhenExpression depending on the odd vs even pages.

 

Example: following print expression would only print if an even page.

 

new Boolean(($V{REPORT_COUNT}.intValue() % 2) == 0)

 

This way you can offset the objects accordingly to get the margin you are looking for on the report.

 

That's all I can think of.

Link to comment
Share on other sites

Thank you for the suggestion.

 

Doubling the elements may not be the ideal solution, but it may be the best currently available and I greatly appreciate your time. If nothing else it at least lets us move on to other challenges.

Link to comment
Share on other sites

Another approch.

Create a Group  on one of your database field. (Start OnNew Page = true) 

On group footer create Subreport  . Aling to left most position.

printWhenExpression: new Boolean(($V{REPORT_COUNT}.intValue() % 2) == 1)      odd

Copy the created subreport on desire right position,  on top of the other subreport.

printWhenExpression: new Boolean(($V{REPORT_COUNT}.intValue() % 2) == 0)      even

Good Luck.

Link to comment
Share on other sites

  • 9 years later...

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...