I am using *.jasper report generated with iReport in Java program. I need to change report orientation programmatically. Here is my code:
final File template = new File("report.jasper");
final JasperReport jasperReport = (JasperReport) JRLoader.loadObject(template);
//connection is defined previously
final JasperPrint print = JasperFillManager.fillReport(jasperReport, metadata, connection);
//reprot.jasper is defined with LANDSCAPE orientation
print.setOrientation(OrientationEnum.PORTRAIT);
The last line has no effect on neither generated pdf or on-screen component.
Any ideas?
Changing the orientation on the JasperPrint object does not change the width or height of the generated pages.
I think you need to change the page orientation before report filling.
Some more details