我已將圖像保存爲我的oracle數據庫中的BLOB。我的模型類包含byte []圖像;對應於數據庫中的BLOB表達式。我必須將數據庫中的所有圖像導出爲PDF。在java中我用下面的代碼:在jasper報告中未顯示BLOB圖像pdf
JasperReport jasperReport = JasperCompileManager.compileReport('jrxml file');
JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(imageObjList);
//imageObjList containing the model 'ImageObj' which contain byte[] image
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter,ds);
JasperExportManager.exportReportToPdfStream(jasperPrint,responce.getOutputStream());
我用iReport的創建JRXML文件
在我JRXML我創建了一個場與場類類型的java.io.InputStream
和圖像在我的圖像我給圖像表達式爲$ F {圖像},並已將圖像類表達式作爲java.awt.Image。
我無法做出我的pdf報告。
我得到一個例外,因爲
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression:
Source text : $F{image}
.....
Caused by: java.lang.ClassCastException: [B cannot be cast to java.io.InputStream
at ImageReport_1374240048064_891215.evaluate(ImageReport_1374240048064_891215:171)
我需要在PDF中的圖像。