我在PDF的末尾有一个额外的白色空白页面,我已经阅读了其他主题,但解决方案对我不起作用。它是来自代码(见下文)还是我要改变属性中的东西?如果需要,我可以加入PDF。
这是我的JXML文件:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.0.final using JasperReports Library version 6.4.1 -->
<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="annoncePDF" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true" uuid="6fa761b0-29ca-4e21-bff3-85bd1fcb6425">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<parameter name="imgPath" class="java.lang.String">
<parameterDescription><![CDATA[imgPath]]></parameterDescription>
</parameter>
<field name="price" class="java.lang.String">
<fieldDescription><![CDATA[price]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
<field name="localization" class="java.lang.String">
<fieldDescription><![CDATA[localization]]></fieldDescription>
</field>
<field name="img1" class="java.lang.String">
<fieldDescription><![CDATA[img1]]></fieldDescription>
</field>
<field name="img2" class="java.lang.String">
<fieldDescription><![CDATA[img2]]></fieldDescription>
</field>
<field name="img3" class="java.lang.String">
<fieldDescription><![CDATA[img3]]></fieldDescription>
</field>
<field name="img4" class="java.lang.String">
<fieldDescription><![CDATA[img4]]></fieldDescription>
</field>
<field name="agencyLogo" class="java.lang.String">
<fieldDescription><![CDATA[agencyLogo]]></fieldDescription>
</field>
<field name="bidType" class="java.lang.String">
<fieldDescription><![CDATA[bidType]]></fieldDescription>
</field>
<field name="realtyType" class="java.lang.String">
<fieldDescription><![CDATA[realtyType]]></fieldDescription>
</field>
<field name="realtyCategory" class="java.lang.String">
<fieldDescription><![CDATA[realtyCategory]]></fieldDescription>
</field>
<field name="contactPhone" class="java.lang.String">
<fieldDescription><![CDATA[contactPhone]]></fieldDescription>
</field>
<field name="monthlycharges" class="java.lang.String">
<fieldDescription><![CDATA[monthlycharges]]></fieldDescription>
</field>
<detail>
<band height="842" splitType="Stretch">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<image scaleImage="FillFrame">
<reportElement x="0" y="0" width="595" height="842" uuid="96dba386-3a03-44cb-84a8-34d76c4be108"/>
<imageExpression><![CDATA[$P{imgPath}+"/annoncePDF/template.jpg"]]></imageExpression>
</image>
<frame>
<reportElement stretchType="ElementGroupBottom" mode="Transparent" x="0" y="138" width="595" height="257" backcolor="#FFFFFF" uuid="b39d04cd-1bfb-4211-96b7-e6123ff0679c">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<image scaleImage="FillFrame" hAlign="Left" onErrorType="Blank">
<reportElement mode="Transparent" x="0" y="0" width="595" height="257" backcolor="#FFFFFF" uuid="4e070521-7016-40bd-95ea-57a8d4146c71">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<imageExpression><![CDATA[$F{img1} != null? $F{img1}:$F{agencyLogo}]]></imageExpression>
</image>
</frame>
<frame>
<reportElement x="396" y="407" width="177" height="132" uuid="44246b8b-246b-4752-8e5a-11b6c277506b">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<image scaleImage="FillFrame" onErrorType="Blank">
<reportElement x="0" y="0" width="177" height="132" uuid="8a5eb8b7-d0dc-4c87-a1ec-664eeab9d2bc">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<imageExpression><![CDATA[$F{img4} != null? $F{img4}:$F{agencyLogo}]]></imageExpression>
</image>
</frame>
<frame>
<reportElement x="209" y="407" width="177" height="132" uuid="b4536946-0dfb-4a02-a7c0-09b3f478d1f4">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<image scaleImage="FillFrame" hAlign="Center" vAlign="Middle" onErrorType="Blank">
<reportElement x="0" y="0" width="177" height="132" uuid="021c1644-08c7-4b57-8abc-732a7da7a9e2">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<imageExpression><![CDATA[$F{img3} == null?$F{agencyLogo}:$F{img3}]]></imageExpression>
</image>
</frame>
<frame>
<reportElement x="22" y="407" width="177" height="132" uuid="45f9926e-65b2-4dad-a064-ce3c47156c3d">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<image scaleImage="FillFrame" onErrorType="Blank">
<reportElement x="0" y="0" width="177" height="132" uuid="b3efbb40-47e9-437f-8451-f062d7c8ddd5">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<imageExpression><![CDATA[$F{img2} != null? $F{img2}:$F{agencyLogo}]]></imageExpression>
</image>
</frame>
<frame>
<reportElement x="36" y="5" width="220" height="131" uuid="452b32ba-ca1b-4eb6-8522-93dd7282f5b2">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<image scaleImage="FillFrame" onErrorType="Blank">
<reportElement x="17" y="0" width="150" height="131" uuid="c2241dfb-418d-4f0f-b3df-992cbab841e7">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<imageExpression><![CDATA[$F{agencyLogo}]]></imageExpression>
</image>
</frame>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement key="" x="270" y="30" width="290" height="34" forecolor="#474747" uuid="1fdc3005-be65-4654-9d21-c77757d2152e">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Right" rotation="None" markup="html">
<font fontName="Lato" size="32" isBold="false" isItalic="true" isUnderline="false" isStrikeThrough="false"/>
</textElement>
<textFieldExpression><![CDATA[($F{bidType}.equals(null)?" ": $F{bidType}.toUpperCase())]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="" x="232" y="64" width="328" height="30" forecolor="#303030" uuid="e49ee12b-de88-488b-b8c5-8cfb16711c3c"/>
<textElement textAlignment="Right" markup="html">
<font fontName="Lato" size="32" isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[($F{realtyCategory}.equals(null)?" ": $F{realtyCategory}.toUpperCase())+" "+
($F{realtyType}.equals(null)?" ": $F{realtyType}.toUpperCase())]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="" x="232" y="102" width="328" height="29" forecolor="#303030" uuid="7f9a97b2-6f5e-417a-883e-79ae479cdeac"/>
<textElement textAlignment="Right" markup="html">
<font fontName="Lato" size="18" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[($F{localization}.equals(null)?"":$F{localization}.toUpperCase())]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="260" y="558" width="300" height="160" forecolor="#424242" uuid="4a3c8f67-272b-4e71-b92d-62d2bbec64ee"/>
<textElement textAlignment="Justified" verticalAlignment="Middle">
<font fontName="Lato Light" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="30" y="555" width="202" height="85" forecolor="#1F1F1F" uuid="1eb1157b-465d-4aec-9e58-86dc466d5426">
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font fontName="Lato" size="23" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[($F{realtyCategory}.equals(null)?" ": $F{realtyCategory}.toUpperCase())+" "+
($F{realtyType}.equals(null)?" ": $F{realtyType}.toUpperCase())]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="30" y="637" width="202" height="73" forecolor="#1F1F1F" uuid="be6f9a34-e913-4688-b18b-d2acbdc8aaba"/>
<textElement textAlignment="Center">
<font fontName="Lato" size="15" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[($F{localization}.equals(null)?" ": $F{localization}.toUpperCase())+" "]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="36" y="744" width="300" height="40" forecolor="#FFFFFF" uuid="bac07815-d9bf-4635-b7ee-aec8ddfad740"/>
<textElement markup="html">
<font fontName="Lato" size="29" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Prix : "+$F{price}+".CFP "+($F{monthlycharges}.equals("")?"": "+ "+$F{monthlycharges}+"CFP " +" de charges mensuelles")]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="215" y="745" width="354" height="34" forecolor="#FFFFFF" uuid="bf153f40-3d6a-474e-ae02-d562e6d43844"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Lato" size="21" isBold="true"/>
<paragraph leftIndent="0" rightIndent="5"/>
</textElement>
<textFieldExpression><![CDATA["Contact "+$F{contactPhone}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
任何帮助将不胜感激。我无法理解为什么最后会有一个空白页面。我检查了我的图像大小,但没有一个比页面本身大。
谢谢,
尼古拉斯
答案 0 :(得分:1)
就我而言,我将所有列表组件放在框架中 这解决了我的问题。
答案 1 :(得分:0)
我发现了问题!
它不是来自JXML文件,而是来自JXML的属性。我不得不点击
忽略分页
感谢。