JasperReport 图像动态垂直拉伸取决于页面大小 - 可以做到吗?
JasperReport image dynamic vertical stretching depending on page size - can it be done?
我有一份看起来像证书的 jasper 报告。
我有一张背景图片作为整个页面的吸引人的边框或框架。
问题是,例如,如果文本字段中的名称比元素容器大得多,它会在底部创建额外的白色 space。
背景图像/框架未拉伸以拉伸页面的整个边缘。
当文本字段较短时也是如此。但是在这种情况下,页面被缩短到你几乎看不到框架底部的程度。
我希望图像在运行时根据页面的最终大小动态拉伸。
这是我的设计外观:
编译的时候是这样的,可以看到底部多了一些白色的space:
这是我图像的当前设置..
职位类型:浮动
拉伸类型:ContainerBottom
jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="paiwi-certificate-pdf" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="792" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="28bcb6f8-04d6-48df-ab31-e1bedc2f2434">
<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="farmContactListSubreportDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<parameter name="farmName" class="java.lang.String"/>
<parameter name="farmLogo" class="java.lang.String"/>
<parameter name="farmAddress" class="java.lang.String"/>
<parameter name="farmBusinessAddress" class="java.lang.String"/>
<parameter name="temporaryPartnersName" class="java.lang.String"/>
<parameter name="partnerName" class="java.lang.String"/>
<parameter name="partnerContactNumber" class="java.lang.String"/>
<parameter name="partnerEmail" class="java.lang.String"/>
<parameter name="packageName" class="java.lang.String"/>
<parameter name="batchName" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<detail>
<band height="612" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement positionType="Float" x="146" y="80" width="224" height="40" forecolor="#332411" uuid="cb95bd0b-631e-4363-80f5-22d0b0e481fe">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false"/>
</textElement>
<text><![CDATA[CERTIFICATE]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="372" width="446" height="28" uuid="6281f2a7-4eca-4319-b298-22184617a6d3">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="24" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="400" width="446" height="17" uuid="f19dc14b-3ada-460b-8633-85fd5a896d45">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmAddress}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="417" width="446" height="17" uuid="dec9944a-2758-4202-acfe-6f97df346b8f">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmBusinessAddress}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="164" y="180" width="473" height="40" forecolor="#332411" uuid="b2a59bb8-1557-498f-b17a-3f0e561bb11b">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="37" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{partnerName} != null && !$P{partnerName}.equalsIgnoreCase("") ? $P{partnerName} : $P{temporaryPartnersName}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement positionType="Float" x="569" y="338" width="164" height="160" uuid="717d6475-3d42-4e54-a69a-7271bc862e33"/>
<imageExpression><![CDATA[$P{farmLogo}]]></imageExpression>
</image>
<staticText>
<reportElement positionType="Float" x="416" y="81" width="228" height="40" forecolor="#332411" uuid="f2a78f2d-ed74-45b9-89e8-3365c4afe801">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false"/>
</textElement>
<text><![CDATA[COMPLETION]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="378" y="80" width="33" height="40" forecolor="#332411" uuid="e1c7ac87-81ce-4e8d-b718-2aee4f139003"/>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false" isItalic="true"/>
</textElement>
<text><![CDATA[of]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="311" y="148" width="179" height="15" forecolor="#6E6E6E" uuid="3d5afae8-14e2-4a3b-8471-db8388e2309f">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[THIS ACKNOWLEDGES THAT]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="290" y="249" width="232" height="15" forecolor="#6E6E6E" uuid="4c301efe-c460-478e-873a-d16430000b18">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[HAS SUCCESSFULLY COMPLETED THE]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="50" y="357" width="232" height="15" forecolor="#6E6E6E" uuid="1060f753-1051-4925-9efe-c2ee62146b25">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[ACKNOWLEDGED BY:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="275" y="279" width="263" height="17" uuid="3ab3ec94-b64f-42df-b475-7996bcac1abb">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{packageName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="359" y="296" width="43" height="16" forecolor="#000000" uuid="c6e10785-2750-4247-af0c-6cbafa3aa294"/>
<textElement markup="none">
<font fontName="Georgia" size="14" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[Batch:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="402" y="296" width="48" height="16" forecolor="#000000" uuid="dff76163-3fd3-4bf6-94fd-de4612485e29">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{batchName}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement positionType="Float" x="140" y="279" width="126" height="30" uuid="b0c2acd4-1a0c-4fe6-9a94-be43fe67d704"/>
<imageExpression><![CDATA["https://i.imgur.com/Ug4T4oX.png"]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement positionType="Float" x="550" y="279" width="126" height="30" uuid="9d2cddda-e519-42e2-b74b-554f4c102ef2"/>
<imageExpression><![CDATA["https://i.imgur.com/paQHNxJ.png"]]></imageExpression>
</image>
<image scaleImage="RetainShape" vAlign="Bottom" onErrorType="Blank" evaluationTime="Page">
<reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="0" width="782" height="612" isPrintInFirstWholeBand="true" uuid="2dadd1da-0694-4e21-86de-fae790844411">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA["https://i.imgur.com/y8uffu8.png"]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
我认为你唯一的问题是你没有正确的 scaleImage
属性 设置,因此元素实际上正在调整大小但是因为你有 scaleImage="RetainShape"
图像将不会填充新的元素尺寸,而是保持原始图像比例
来自 Jasper Reports 终极指南:
- Clipping the image: If the actual image is larger than the image element size, it will be cut off so that it keeps its original
resolution, and only the region that fits the specified size will be
displayed (
scaleImage="Clip"
).
- Forcing the image size: If the dimensions of the actual image do not fit those specified for the image element that displays it, the image
is forced to obey them and stretch itself so that it fits in the
designated output area. It will be deformed if necessary
(
scaleImage="FillFrame"
).
Keeping the image proportions: If the actual image does not fit into the image element, it can be adapted to those dimensions while
keeping its original undeformed proportions
(scaleImage="RetainShape"
).
Stretching the image keeping the width: The image can be stretched vertically to match the actual image height, while preserving the
declared width of the image element (scaleImage="RealHeight"
).
Stretching the image adjusting the width: The image can be stretched vertically to match the actual image height, while adjusting
the width of the image element to match the actual image width
(scaleImage="RealSize"
).
所以你需要:
scaleImage="FillFrame"
像这样
<image scaleImage="FillFrame" vAlign="Bottom" onErrorType="Blank">
<reportElement stretchType="ContainerHeight" x="10" y="0" width="782" height="612" uuid="2dadd1da-0694-4e21-86de-fae790844411">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA["https://i.imgur.com/y8uffu8.png"]]></imageExpression>
</image>
我有一份看起来像证书的 jasper 报告。
我有一张背景图片作为整个页面的吸引人的边框或框架。
问题是,例如,如果文本字段中的名称比元素容器大得多,它会在底部创建额外的白色 space。
背景图像/框架未拉伸以拉伸页面的整个边缘。
当文本字段较短时也是如此。但是在这种情况下,页面被缩短到你几乎看不到框架底部的程度。
我希望图像在运行时根据页面的最终大小动态拉伸。
这是我的设计外观:
编译的时候是这样的,可以看到底部多了一些白色的space:
这是我图像的当前设置..
职位类型:浮动
拉伸类型:ContainerBottom
jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.8.0.final using JasperReports Library version 6.8.0-2ed8dfabb690ff337a5797129f2cd92902b0c87b -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="paiwi-certificate-pdf" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="792" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="28bcb6f8-04d6-48df-ab31-e1bedc2f2434">
<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String"/>
<parameter name="farmContactListSubreportDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<parameter name="farmName" class="java.lang.String"/>
<parameter name="farmLogo" class="java.lang.String"/>
<parameter name="farmAddress" class="java.lang.String"/>
<parameter name="farmBusinessAddress" class="java.lang.String"/>
<parameter name="temporaryPartnersName" class="java.lang.String"/>
<parameter name="partnerName" class="java.lang.String"/>
<parameter name="partnerContactNumber" class="java.lang.String"/>
<parameter name="partnerEmail" class="java.lang.String"/>
<parameter name="packageName" class="java.lang.String"/>
<parameter name="batchName" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<detail>
<band height="612" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<staticText>
<reportElement positionType="Float" x="146" y="80" width="224" height="40" forecolor="#332411" uuid="cb95bd0b-631e-4363-80f5-22d0b0e481fe">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false"/>
</textElement>
<text><![CDATA[CERTIFICATE]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="372" width="446" height="28" uuid="6281f2a7-4eca-4319-b298-22184617a6d3">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="24" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmName}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="400" width="446" height="17" uuid="f19dc14b-3ada-460b-8633-85fd5a896d45">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmAddress}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="50" y="417" width="446" height="17" uuid="dec9944a-2758-4202-acfe-6f97df346b8f">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{farmBusinessAddress}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="164" y="180" width="473" height="40" forecolor="#332411" uuid="b2a59bb8-1557-498f-b17a-3f0e561bb11b">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="37" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{partnerName} != null && !$P{partnerName}.equalsIgnoreCase("") ? $P{partnerName} : $P{temporaryPartnersName}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement positionType="Float" x="569" y="338" width="164" height="160" uuid="717d6475-3d42-4e54-a69a-7271bc862e33"/>
<imageExpression><![CDATA[$P{farmLogo}]]></imageExpression>
</image>
<staticText>
<reportElement positionType="Float" x="416" y="81" width="228" height="40" forecolor="#332411" uuid="f2a78f2d-ed74-45b9-89e8-3365c4afe801">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false"/>
</textElement>
<text><![CDATA[COMPLETION]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="378" y="80" width="33" height="40" forecolor="#332411" uuid="e1c7ac87-81ce-4e8d-b718-2aee4f139003"/>
<textElement markup="none">
<font fontName="Georgia" size="34" isBold="false" isItalic="true"/>
</textElement>
<text><![CDATA[of]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="311" y="148" width="179" height="15" forecolor="#6E6E6E" uuid="3d5afae8-14e2-4a3b-8471-db8388e2309f">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[THIS ACKNOWLEDGES THAT]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="290" y="249" width="232" height="15" forecolor="#6E6E6E" uuid="4c301efe-c460-478e-873a-d16430000b18">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[HAS SUCCESSFULLY COMPLETED THE]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" x="50" y="357" width="232" height="15" forecolor="#6E6E6E" uuid="1060f753-1051-4925-9efe-c2ee62146b25">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement markup="none">
<font fontName="Verdana" size="12" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[ACKNOWLEDGED BY:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="275" y="279" width="263" height="17" uuid="3ab3ec94-b64f-42df-b475-7996bcac1abb">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{packageName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement positionType="Float" x="359" y="296" width="43" height="16" forecolor="#000000" uuid="c6e10785-2750-4247-af0c-6cbafa3aa294"/>
<textElement markup="none">
<font fontName="Georgia" size="14" isBold="false"/>
<paragraph lineSpacingSize="1.0"/>
</textElement>
<text><![CDATA[Batch:]]></text>
</staticText>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="402" y="296" width="48" height="16" forecolor="#000000" uuid="dff76163-3fd3-4bf6-94fd-de4612485e29">
<property name="com.jaspersoft.studio.unit.x" value="px"/>
</reportElement>
<textElement textAlignment="Center">
<font fontName="Georgia" size="14" isBold="false" isUnderline="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{batchName}]]></textFieldExpression>
</textField>
<image onErrorType="Blank">
<reportElement positionType="Float" x="140" y="279" width="126" height="30" uuid="b0c2acd4-1a0c-4fe6-9a94-be43fe67d704"/>
<imageExpression><![CDATA["https://i.imgur.com/Ug4T4oX.png"]]></imageExpression>
</image>
<image onErrorType="Blank">
<reportElement positionType="Float" x="550" y="279" width="126" height="30" uuid="9d2cddda-e519-42e2-b74b-554f4c102ef2"/>
<imageExpression><![CDATA["https://i.imgur.com/paQHNxJ.png"]]></imageExpression>
</image>
<image scaleImage="RetainShape" vAlign="Bottom" onErrorType="Blank" evaluationTime="Page">
<reportElement positionType="Float" stretchType="ContainerBottom" x="0" y="0" width="782" height="612" isPrintInFirstWholeBand="true" uuid="2dadd1da-0694-4e21-86de-fae790844411">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA["https://i.imgur.com/y8uffu8.png"]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
我认为你唯一的问题是你没有正确的 scaleImage
属性 设置,因此元素实际上正在调整大小但是因为你有 scaleImage="RetainShape"
图像将不会填充新的元素尺寸,而是保持原始图像比例
来自 Jasper Reports 终极指南:
- Clipping the image: If the actual image is larger than the image element size, it will be cut off so that it keeps its original resolution, and only the region that fits the specified size will be displayed (
scaleImage="Clip"
).- Forcing the image size: If the dimensions of the actual image do not fit those specified for the image element that displays it, the image is forced to obey them and stretch itself so that it fits in the designated output area. It will be deformed if necessary (
scaleImage="FillFrame"
).Keeping the image proportions: If the actual image does not fit into the image element, it can be adapted to those dimensions while keeping its original undeformed proportions (
scaleImage="RetainShape"
).Stretching the image keeping the width: The image can be stretched vertically to match the actual image height, while preserving the declared width of the image element (
scaleImage="RealHeight"
).Stretching the image adjusting the width: The image can be stretched vertically to match the actual image height, while adjusting the width of the image element to match the actual image width (
scaleImage="RealSize"
).
所以你需要:
scaleImage="FillFrame"
像这样
<image scaleImage="FillFrame" vAlign="Bottom" onErrorType="Blank">
<reportElement stretchType="ContainerHeight" x="10" y="0" width="782" height="612" uuid="2dadd1da-0694-4e21-86de-fae790844411">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<imageExpression><![CDATA["https://i.imgur.com/y8uffu8.png"]]></imageExpression>
</image>