【发布时间】:2014-08-07 07:24:17
【问题描述】:
我正在使用 Jasper Reports (5.0.0) 生成 PDF 和 Word 文档。
在其中一个文档中,我必须显示来自 URL 的图像。图像是在生成报告之前动态生成的,但我无法控制它(所以我不能在源头旋转它)。
是否可以让 Jasper 在生成文档时旋转图像?
这是图片的模板代码:
<band height="706">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<image rotation="Left" scaleImage="RetainShape" hAlign="Center" vAlign="Middle" isUsingCache="false" isLazy="true" evaluationTime="Report">
<reportElement key="" stretchType="RelativeToBandHeight" x="12" y="0" width="530" height="704" uuid="fc32abee-32e1-4b07-94f0-177eae9edcad">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="local_mesure_unitx" value="pixel"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA[new java.net.URL($P{MAP_URL})]]></imageExpression>
</image>
</band>
如您所见,图像 URL 作为参数传递给报告,并由 Jasper 通过 java URL 访问。 (如果没有简单的解决方案,我打算编写一个 servlet 来获取图像并旋转输出,但我宁愿避免这样做)。
【问题讨论】:
-
@AlexK 我不是在问如何自己旋转图像,我是在问 jasper 是否支持开箱即用。
-
I'm asking if jasper supports that out of the box- 没有。
标签: jasper-reports