【发布时间】:2018-10-23 02:48:16
【问题描述】:
如何使用jasper studio在jasper报表中添加动态图片。数据库是postgresql
图片以bytea格式存储
如何在 jasper 报告中显示该图像。
如何解决这个问题?还有其他方法吗?
数据库查询 ->
select encode(image,'escape') as img,id from entity_image where entity_id = 100
图像表达-> new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{image}.getBytes()))
【问题讨论】:
-
你能分享一下你到目前为止所尝试的吗?
-
数据库查询-> select encode(image,'escape') as img,id from entity_image where entity_id = 100 image expression-> new java.io.ByteArrayInputStream(org.apache.commons.codec .binary.Base64.decodeBase64($F{image}.getBytes()))
-
你可以添加这个问题吗?
-
您不需要对 bytea 数据进行编码/解码。只需选择 image as img ...,将字段类型设置为 java.awt.Image 并使用 $F{image} 作为图像表达式。
标签: jasper-reports