jasperreports,JasperViewer客户端打印
[b]用JasperViewer.viewReport遇到一怪问题.当用JasperViewer.viewReport(jasperPrint, false);时预览窗口在服务器端打开,客户不显示任何窗口[/b]
代码如下:
try (InputStream input = InspectsSumController.class.getResourceAsStream("/com/huaxi/vdm/reports/sum_inspects.jasper")){
List<Map<String, Object>> list = examinesService.sumInspectId(inspectId, exaBegin, exaEnd);
JRMapArrayDataSource dataSource = new JRMapArrayDataSource(list.toArray());
Map<String, Object> params = new HashMap<>();
params.put("exaBegin", exaBegin);
params.put("exaEnd", exaEnd);
JasperPrint jasperPrint = JasperFillManager.fillReport(input, params, dataSource);
ExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
ServletOutputStream outputStream = response.getOutputStream();
String fileName="检验类别分类合格率汇总表";
if(act.equals("print"))
{
JasperViewer.viewReport(jasperPrint,false);
}