0 0

jasperreport0

ireport做报表。然后页面显示。下载pdf格式。
下载出来的pdf文件,用福昕阅读器打开显示正常。可是用adobe阅读器打开是空白的。不知道哪位知道怎么回事。

问题补充:FileBufferedOutputStream fbos = new FileBufferedOutputStream();
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, fbos);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
//exporter.setParameter(JRPdfExporterParameter.CHARACTER_ENCODING,"GBK");
exporter.setParameter(JRPdfExporterParameter.PRINT_SCALING,"100");
try {
exporter.exportReport();
fbos.close();
if (fbos.size() > 0) {
response.reset();
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;filename="
+ new String(this.getFileName(jasperName,request).getBytes("gb2312"), "iso8859-1") + ".pdf");
response.setContentLength(fbos.size());
ServletOutputStream ouputStream = response.getOutputStream();

fbos.writeData(ouputStream);
fbos.dispose();
ouputStream.flush();
ouputStream.close();


}
} catch (JRException e1) {
e1.printStackTrace();
} finally {
if (null != fbos) {
fbos.close();
fbos.dispose();
}
}
}
2012年11月06日 10:34
目前还没有答案

相关推荐

Global site tag (gtag.js) - Google Analytics