Estou tentando fazer uma impressão com JasperReports, no momento de compilar o relatório recebo o seguinte erro:
Exception in thread "main"
net.sf.jasperreports.engine.design.JRValidationException: Report
design not valid :
- The columns and the margins do not fit the page width.
- The background section and the margins do not fit the page height.
- The title section, the page and column headers and footers and the margins do not fit the page height.
- The page and column headers and footers and the margins do not fit the page height.
- The page and column headers and footers and the margins do not fit the last page height.
- The summary section and the margins do not fit the page height.
- The detail section, the page and column headers and footers and the margins do not fit the page height.
- The noData section and the margins do not fit the page height. at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:271) at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:153) at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:241) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:501) at testeimpressao.Impressao.Imprimir(Impressao.java:49)
Segue abaixo o código de teste:
JasperDesign report = new JasperDesign();
report.setName("teste");
report.setPageWidth(90);
report.setPageHeight(45);
JRDesignBand band = new JRDesignBand();
band.setHeight(45);
JRDesignStaticText text = new JRDesignStaticText();
text.setText("Primeira impressão");
text.setHeight(20);
text.setWidth(60);
text.setX(1);
text.setY(1);
band.addElement(text);
((JRDesignSection)report.getDetailSection()).addBand(band);
JasperReport relatorio = JasperCompileManager.compileReport(report); //Aqui ocorre o erro
JasperPrint print = JasperFillManager.fillReport(relatorio, new HashMap<>());
JasperViewer jrviewer = new JasperViewer(print, false);
jrviewer.setVisible(true);