I created a report page with A4 format in iReport4.5 and use in java application.
how to change A4 to A5 format on runtime in java application?
Before I show you how to do this, please note that just changing the Page Size is probably not going to give you what your want. It will make the page larger or smaller depending on what you want, put the positioning of elements will not change. IN your case the report may not even compile depending on where you have items laid out.
You do have a couple options though:
JasperDesign
object:
//Note JRXMLLoader could also take a File object or
//InputStream instead of a String as the parameter.
JasperDesign design = JRXmlLoader.load("report.jrxml");
Once you have the JasperDesign
you can set the page size to what ever you want. A5 paper from what I can tell is 5.83" × 8.27". To convert this to a size that JasperReports understands multiply each by 72, getting you 420 x 596 (I rounded as we have to set Integers).
design.setPageHeight(596);
design.setPageWidth(420);
From there you cointinue on your exporting adventure as you normally would.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With