【问题标题】:How to rotate a dynamic image 90 degrees in a jasper report?如何在碧玉报告中将动态图像旋转 90 度?
【发布时间】: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 来获取图像并旋转输出,但我宁愿避免这样做)。

【问题讨论】:

标签: jasper-reports


【解决方案1】:

不,我很确定你不能。。就 Jasper Studio 而言,整个图形情况令人心碎。最好的办法是在将图像放入 JasperStudio 之前对其进行更改,因为只有您被允许重新调整大小。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-08
    • 1970-01-01
    相关资源
    最近更新 更多