我在自定义页面大小报告方面遇到了一些问题。好像是 打印例程总是为打印作业添加默认边距,但在 JRXML我为报告定义了零保证金。
此问题会影响打印机上打印的特殊报告 报告假设是组件的确切大小。 由于不适当的边距,留下一些组件,如框架部分未打印。
为了澄清,我使用JRPrintServiceExporter类(JasperPrint) 将作业发送到打印机。在IReport中生成报告,在预览中,报告显示正确,但问题仍然存在。
我正在将报告的JRXML一起发送给你。
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<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="officina1" pageWidth="357" pageHeight="595" columnWidth="278" leftMargin="49" rightMargin="30" topMargin="0" bottomMargin="39" uuid="0ac9c201-40e2-4898-a527-ffe7b9b210ef">
<import value="net.sf.jasperreports.engine.*"/>
<import value="de.benco.reports.medication.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<parameter name="REPORT_HAS_EDGE" class="java.lang.Boolean" isForPrompting="false">
<defaultValueExpression><![CDATA[new Boolean(false)]]></defaultValueExpression>
</parameter>
<field name="TCDOC_doc_firstname" class="java.lang.String"/>
<field name="TCDOC_doc_lastname" class="java.lang.String"/>
<field name="TCDOC_doc_inami" class="java.lang.String"/>
<field name="TCDOC_doc" class="java.lang.String"/>
<field name="TCDOC_doc_address" class="java.lang.String"/>
<field name="TCDOC_doc_zipid" class="java.lang.String"/>
<field name="TCDOC_doc_zipname" class="java.lang.String"/>
<field name="TCDOC_doc_telno" class="java.lang.String"/>
<field name="TCDOC_doc_faxno" class="java.lang.String"/>
<field name="TCDOC_doc_mobileno" class="java.lang.String"/>
<field name="PI_legalname" class="java.lang.String"/>
<field name="PI_firstname" class="java.lang.String"/>
<field name="prescriptions" class="net.sf.jasperreports.engine.JRDataSource"/>
<field name="barcode" class="java.awt.Image"/>
<background>
<band height="556" splitType="Prevent">
<rectangle>
<reportElement key="rectangle-5" x="0" y="0" width="297" height="556" uuid="e47f81de-fd8b-47ab-aab7-f3caf2f6ccd4">
<printWhenExpression><![CDATA[$P{REPORT_HAS_EDGE}]]></printWhenExpression>
</reportElement>
</rectangle>
<line>
<reportElement key="line-3" x="147" y="114" width="1" height="61" uuid="4d2e69cd-158a-49f9-9ea9-10b23244f95b"/>
</line>
<line>
<reportElement key="line-4" x="0" y="175" width="297" height="1" uuid="52c3c6ad-1599-4115-8933-02bb827c3258"/>
</line>
<line>
<reportElement key="line-1" x="150" y="451" width="1" height="93" uuid="270ae48a-6ac8-4f67-a976-b0cb857e87c6"/>
</line>
<line>
<reportElement key="line-2" x="150" y="499" width="147" height="1" uuid="4d0a1214-ba95-4480-9867-2784eccee6e2"/>
</line>
<line>
<reportElement key="line-7" x="90" y="215" width="1" height="236" uuid="578bfbee-ab3d-47b8-8103-fad607bf0d49"/>
</line>
<textField isBlankWhenNull="false">
<reportElement key="staticText-8" x="7" y="220" width="78" height="20" uuid="6c78226d-8e09-4c22-9c70-ef68c28d1e5e"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Verdana" size="6" isBold="false" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{medic.benco.voorbehouden}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-15" x="0" y="543" width="293" height="13" uuid="fbf19ae3-575a-4b1c-b098-20c4310e3731"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{medic.benco.title}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-16" x="150" y="455" width="147" height="14" uuid="702e52d9-2b8e-4eb4-8fe1-bdc38490c0d0"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="7" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{medic.benco.datum}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-17" x="150" y="503" width="147" height="24" uuid="423a8b90-bed2-48af-b766-63041098ffb1"/>
<box leftPadding="4" rightPadding="4">
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="7" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{action.decina.uitvoerbaar}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-18" x="1" y="455" width="149" height="14" uuid="af2434af-b16a-4edf-ad40-de34d8452bb8"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="7" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{action.decina.stempel}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-19" x="7" y="180" width="176" height="10" uuid="95a7d607-47b8-42f7-8f35-5430a60c10b2"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left">
<font fontName="SansSerif" size="7" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{action.decina.invullen}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-20" x="7" y="191" width="82" height="20" uuid="0481174b-2efa-4c07-acee-7b6287539bd7"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Left">
<font fontName="SansSerif" size="7" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{action.decina.rechthebbende}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-21" x="153" y="120" width="136" height="14" uuid="71d41d3a-6732-4bee-8960-33370f64c873"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="7" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{action.decina.phd}]]></textFieldExpression>
</textField>
<line>
<reportElement key="line-10" x="156" y="538" width="136" height="1" forecolor="#CCCCCC" uuid="6ef16794-0259-4018-a2bc-89d75a9a68b5"/>
<graphicElement>
<pen lineWidth="1.0" lineStyle="Dotted"/>
</graphicElement>
</line>
<line>
<reportElement key="line-11" mode="Opaque" x="77" y="206" width="215" height="1" forecolor="#CCCCCC" uuid="3d8b76dc-5ee8-4c36-ac52-57aa30a8a55d"/>
<graphicElement>
<pen lineWidth="1.0" lineStyle="Dotted"/>
</graphicElement>
</line>
<line>
<reportElement key="line-4" x="0" y="113" width="297" height="1" uuid="a061e20a-a532-4f37-b549-9be8ef35c634"/>
</line>
<line>
<reportElement key="line-4" x="0" y="215" width="297" height="1" uuid="592dad44-6bdb-4249-8c56-14b8d10e960c"/>
</line>
<line>
<reportElement key="line-4" x="0" y="450" width="297" height="1" uuid="02d04e02-acec-4a6e-9d42-aefef82d0eb5"/>
</line>
<line>
<reportElement key="line-4" x="0" y="543" width="297" height="1" uuid="5e8c73d3-41c4-43df-93f4-1ddc1b0a1e73"/>
</line>
</band>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band height="216" splitType="Stretch">
<textField isBlankWhenNull="false">
<reportElement key="textField" x="155" y="148" width="138" height="25" uuid="726b701b-9864-4889-84f8-72cb66992857"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[(($F{TCDOC_doc_lastname}==null&&$F{TCDOC_doc_firstname}==null)||("".equals($F{TCDOC_doc_lastname})&&"".equals($F{TCDOC_doc_firstname})))
?"// // // //":$F{TCDOC_doc_lastname}+" "+$F{TCDOC_doc_firstname}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="textField-1" x="84" y="197" width="207" height="12" uuid="8ca902d4-db1b-4d2a-be01-da733ef31295"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Times New Roman" size="9" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{PI_legalname}+" "+$F{PI_firstname}]]></textFieldExpression>
</textField>
<image scaleImage="FillFrame" hAlign="Center" vAlign="Middle">
<reportElement key="barcode-1" positionType="Float" mode="Opaque" x="18" y="121" width="112" height="38" forecolor="#000000" backcolor="#FFFFFF" uuid="a28724e8-df42-457a-b868-2ef2dd67e64e">
<printWhenExpression><![CDATA[new Boolean(!"".equalsIgnoreCase($F{TCDOC_doc_inami}.trim()))]]></printWhenExpression>
</reportElement>
<graphicElement fill="Solid"/>
<imageExpression><![CDATA[$F{barcode}]]></imageExpression>
</image>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement key="textField-5" positionType="Float" x="4" y="159" width="138" height="13" uuid="53e32567-874f-4d44-a1c2-77efd631a5ab">
<printWhenExpression><![CDATA[new Boolean($F{TCDOC_doc_inami}!=null)]]></printWhenExpression>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="Serif" size="8" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{TCDOC_doc_inami}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="16" splitType="Stretch">
<subreport isUsingCache="true">
<reportElement key="subreport-1" stretchType="RelativeToTallestObject" x="88" y="2" width="205" height="12" uuid="96d39cd8-aee9-411c-b63d-f3311eada6c4"/>
<dataSourceExpression><![CDATA[$F{prescriptions}]]></dataSourceExpression>
<subreportExpression><![CDATA[this.getClass().getResourceAsStream("/de/benco/reports/action/templates/decina_sub.jasper")]]></subreportExpression>
</subreport>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="100" splitType="Stretch">
<frame>
<reportElement x="0" y="21" width="159" height="56" isRemoveLineWhenBlank="true" uuid="9fc9ed68-9778-49f8-85e6-ac51940d0023"/>
</frame>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement key="textField-3" x="0" y="21" width="150" height="14" uuid="824ad70c-e30a-482a-87b0-c4b2eace4d50"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="Serif" size="8" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{TCDOC_doc}==null||"".equals($F{TCDOC_doc})?"// // // //":($F{TCDOC_doc}+" "+((($F{TCDOC_doc_lastname}==null&&$F{TCDOC_doc_firstname}==null)||("".equals($F{TCDOC_doc_lastname})&&"".equals($F{TCDOC_doc_firstname})))
?"...........":$F{TCDOC_doc_lastname}+" "+$F{TCDOC_doc_firstname}))]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-10" x="1" y="30" width="149" height="14" uuid="31a4c336-4c64-474e-ba2c-3ee9d88af772"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="Serif" size="9" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{TCDOC_doc_address}==null||"".equals($F{TCDOC_doc_address})?"// // // //":$F{TCDOC_doc_address}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="false">
<reportElement key="staticText-10" x="1" y="42" width="149" height="14" uuid="fe1fb078-234a-448c-97a4-71ee4a16c93c"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="Serif" size="9" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[(($F{TCDOC_doc_zipid}==null&&$F{TCDOC_doc_zipid}==null)||("".equals($F{TCDOC_doc_zipname})&&"".equals($F{TCDOC_doc_zipname})))
?"// // // //":$F{TCDOC_doc_zipid}+" "+$F{TCDOC_doc_zipname}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement key="staticText-10" x="1" y="54" width="149" height="12" isRemoveLineWhenBlank="true" uuid="120bf709-0584-4454-a72a-63156181bb09">
<printWhenExpression><![CDATA[$F{TCDOC_doc_telno} !=null]]></printWhenExpression>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="Serif" size="9" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{TCDOC_doc_telno}==null||"".equals($F{TCDOC_doc_telno})?"// // // //":$F{TCDOC_doc_telno}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="false">
<reportElement key="textField-4" positionType="Float" x="0" y="64" width="150" height="13" uuid="f4a57159-e72a-47c9-9baa-dcdb71b55d9a">
<printWhenExpression><![CDATA[new Boolean($F{TCDOC_doc_inami}!=null)]]></printWhenExpression>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center">
<font fontName="Serif" size="8" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{TCDOC_doc_inami}]]></textFieldExpression>
</textField>
<staticText>
<reportElement key="staticText-12" x="221" y="5" width="0" height="0" uuid="42d0d35c-4787-4b1e-ba22-d7697ad12bf4"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="false"/>
</textElement>
<text><![CDATA[Static Text]]></text>
</staticText>
<textField isBlankWhenNull="false">
<reportElement key="textField-6" x="161" y="30" width="131" height="13" uuid="ac27a1f8-fdb7-4e81-b88d-d188a905d34a"/>
<textElement>
<font fontName="Times New Roman" size="9"/>
</textElement>
<textFieldExpression><![CDATA[new SimpleDateFormat("dd/MM/yyyy").format(new Date())]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>