Reputation: 91
I am using JasperReports-6.2.2 with java to export pdf file. Jasper tempalte 'template.jrxml' is created using iReports 5.6.0
.jrxml file is loaded using JRXmlLoader
JasperDesign design = JRXmlLoader.load("template.jrxml");
design.setTopMargin(20);
design.setBottomMargin(20);
design.setLeftMargin(50);
JasperReport jasperReport = jasperCompileManager.compileReport(design);
This gives error : Report Design not valid.The columns and the margins do not fit the page width.
How to set dynamic left and right margin??
Upvotes: 1
Views: 1785
Reputation: 63
You have to make sure that left margin + column width + right margin = page width. You have to set all this properties in the JasperDesign. http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/design/JasperDesign.html#setPageWidth(int)
Best regards
Upvotes: 1