ireport生成的报表,由于业务需要,生成的报表纸张是A5,同时A5纸需要横向打印。
通过设置jasperprint对象的属性来实现
代码:
paperSize是自定义的纸张
switch (paperSize){
case "A4":
jasperPrint.setPageHeight(842);
jasperPrint.setPageWidth(595);
break;
case "A5":
jasperPrint.setPageHeight(421);
jasperPrint.setPageWidth(595);
jasperPrint.setOrientation(OrientationEnum.LANDSCAPE);//横向打印
break;
case "A76":
jasperPrint.setPageHeight(170);
jasperPrint.setPageWidth(198);
break;
default:
jasperPrint.setPageHeight(842);
jasperPrint.setPageWidth(595);
}