0
votes

I have created a JRXML file using iReports. It has a header and a footer. In the details band, i have a text field which has large content of normally about 2 pages. I have enabled the Stretch with overflow option.

Now when i generate the PDF report the last 1-2 lines at the bottom of the page go missing/cut/hidden. I thought and removed the header and footer. But that also didnt solve the problem. I have kept bottom page margin at 20.

This means that at the page break area this problem is occuring.

The following is the JRXML Content:

<?xml version="1.0" encoding="UTF-8"?>
<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="test" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="5" bottomMargin="5" uuid="53aa864d-199b-459a-ba86-50a79a5a65a4">
    <property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
    <subDataset name="dataset1" uuid="a4f2a563-4bd0-4885-b1a0-ac4fa8bd3f5b">
        <field name="ccRow" class="java.lang.String">
            <fieldDescription><![CDATA[_THIS]]></fieldDescription>
        </field>
    </subDataset>
    <field name="providerName" class="java.lang.String"/>
    <field name="img" class="java.awt.Image"/>
    <field name="patientName" class="java.lang.String"/>
    <field name="patientMR" class="java.lang.String"/>
    <field name="gender" class="java.lang.String"/>
    <field name="birthDate" class="java.lang.String"/>
    <field name="dateAndTime" class="java.lang.String"/>
    <field name="capturedImage" class="java.awt.Image"/>
    <field name="formattedNoteData" class="java.lang.String"/>
    <field name="refDoc" class="java.lang.String"/>
    <field name="address" class="java.lang.String"/>
    <field name="ccList" class="java.util.Collection"/>
    <field name="credentials" class="java.lang.String"/>
    <field name="proCred" class="java.lang.String"/>
    <field name="firstLine" class="java.lang.String"/>
    <field name="secondLine" class="java.lang.String"/>
    <field name="country" class="java.lang.String"/>
    <field name="phNumber" class="java.lang.String"/>
    <field name="faxNumber" class="java.lang.String"/>
    <field name="email" class="java.lang.String"/>
    <field name="imagePrac" class="java.awt.Image"/>
    <pageHeader>
        <band height="27" splitType="Stretch">
            <staticText>
                <reportElement x="-6" y="0" width="325" height="13" uuid="6b4c5a9f-4538-40ce-8c73-9ebd6f5c59ba"/>
                <textElement>
                    <font fontName="Times New Roman" size="6"/>
                </textElement>
                <text><![CDATA[Oral & Maxillofacial Surgery Clinical Electronic Record]]></text>
            </staticText>
        </band>
    </pageHeader>
    <detail>
        <band height="515">
            <image scaleImage="RetainShape" isUsingCache="false">
                <reportElement x="196" y="0" width="230" height="70" uuid="a088b7f1-c74c-404c-8c19-9f9346d25165"/>
                <imageExpression><![CDATA[$F{imagePrac}]]></imageExpression>
            </image>
            <line>
                <reportElement x="0" y="72" width="572" height="1" uuid="b00781d9-b84e-4f61-a2a4-6b229139cdbc"/>
                <graphicElement>
                    <pen lineStyle="Double"/>
                </graphicElement>
            </line>
            <textField isBlankWhenNull="true">
                <reportElement x="177" y="79" width="208" height="13" uuid="044e719b-f9a1-45f0-9a06-ce9dd1f760b2"/>
                <textElement textAlignment="Center">
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{providerName}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="201" y="92" width="159" height="13" isRemoveLineWhenBlank="true" uuid="3771672a-13a3-455d-a4da-9510717abd3e"/>
                <textElement textAlignment="Center">
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{firstLine}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="201" y="105" width="159" height="13" isRemoveLineWhenBlank="true" uuid="46f6496b-788f-4e95-8347-eb8290a48924"/>
                <textElement textAlignment="Center">
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{secondLine}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="201" y="118" width="159" height="13" isRemoveLineWhenBlank="true" uuid="16836b5e-9012-491c-be1e-23a88f3a9bf2"/>
                <textElement textAlignment="Center">
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{country}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="215" y="130" width="133" height="13" uuid="931aabed-e782-4629-b8ee-5d1a4d8f9f50"/>
                <textElement textAlignment="Center" markup="html">
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{phNumber} == null ? "" : "<b>Phone: </b>" +$F{phNumber}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="216" y="143" width="130" height="13" isRemoveLineWhenBlank="true" uuid="5a7d4295-a38d-4975-a97d-7afc2d77e2db"/>
                <textElement textAlignment="Center" markup="html">
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{faxNumber} ==null ? "" :"<b>Fax: </b>" + $F{faxNumber}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="172" y="156" width="223" height="13" uuid="62fd8172-e885-4b63-9653-63713c2c2662"/>
                <textElement textAlignment="Center" markup="html">
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{email}!=null ? "<b>Email: </b>" + $F{email} : " "]]></textFieldExpression>
            </textField>
            <line>
                <reportElement x="0" y="171" width="572" height="1" uuid="9527ae6f-7293-43e3-9e77-a2dc56a727d3">
                    <printWhenExpression><![CDATA[$F{refDoc} != null]]></printWhenExpression>
                </reportElement>
            </line>
            <staticText>
                <reportElement x="0" y="171" width="125" height="19" isRemoveLineWhenBlank="true" uuid="8c6d4745-4654-4a6b-bcc4-b2b76571fa53">
                    <printWhenExpression><![CDATA[$F{refDoc} != null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[Referring Doctor :]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="190" width="170" height="13" isRemoveLineWhenBlank="true" uuid="154add6d-5fa2-4aea-b34b-5b9b1b11146b"/>
                <textElement>
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{refDoc}==null?"":($F{refDoc}+", "+$F{credentials})]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="203" width="572" height="13" isRemoveLineWhenBlank="true" uuid="097d0924-ab63-46f6-b4e5-0d048fb78ffe"/>
                <textElement markup="html">
                    <font size="6" isBold="false"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{address}==null?"":$F{address}]]></textFieldExpression>
            </textField>
            <line>
                <reportElement x="0" y="216" width="572" height="1" isRemoveLineWhenBlank="true" uuid="e24c47c9-5c1c-463f-855b-3755cf9e372b"/>
            </line>
            <image>
                <reportElement x="0" y="218" width="89" height="87" uuid="e0bbb98b-d689-4ae3-8ee9-eddefddcf705"/>
                <imageExpression><![CDATA[$F{img}]]></imageExpression>
            </image>
            <staticText>
                <reportElement x="101" y="222" width="79" height="13" uuid="898012d3-c308-47a8-86c3-aa01d6e94521"/>
                <textElement textAlignment="Left">
                    <font size="6"/>
                </textElement>
                <text><![CDATA[Patient Name :]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="179" y="222" width="196" height="13" uuid="5b145ec7-1028-4663-93e2-d4701e60d00c"/>
                <textElement>
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{patientName}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="101" y="234" width="79" height="13" uuid="1dd3283d-51aa-45a6-b30c-09bcbabbeec7"/>
                <textElement textAlignment="Left">
                    <font size="6"/>
                </textElement>
                <text><![CDATA[Patient MR# :]]></text>
            </staticText>
            <textField>
                <reportElement x="179" y="234" width="196" height="13" uuid="17626ebc-0558-478b-bd06-c9b70d1ba261"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{patientMR}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="101" y="246" width="79" height="13" uuid="dc43a118-a847-421a-8ced-d236c6c9b61a"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <text><![CDATA[Patient Gender :]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="179" y="246" width="100" height="13" uuid="f1d01437-6277-479e-b446-00b151507d45"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{gender}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="101" y="258" width="90" height="13" uuid="09ca7fd8-efc4-4903-b755-5eb67eb0e434"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <text><![CDATA[Patient Birth Date :]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="190" y="258" width="175" height="13" uuid="82fa7dc4-e6bb-4f61-bdcb-d04e2438a020"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{birthDate}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="101" y="270" width="137" height="13" uuid="54b83ed0-b61b-44ed-9067-dc15b928ff44"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <text><![CDATA[Original Note Date and Time :]]></text>
            </staticText>
            <textField isBlankWhenNull="true">
                <reportElement x="237" y="270" width="180" height="13" uuid="41bb843a-0a0e-4f1b-89af-4775c0025e79"/>
                <textElement>
                    <font size="6" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{dateAndTime}]]></textFieldExpression>
            </textField>
            <line>
                <reportElement x="0" y="314" width="572" height="1" uuid="a99e28ef-eaa4-454b-857b-b24f83462902"/>
            </line>
            <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                <reportElement mode="Opaque" x="18" y="322" width="531" height="106" uuid="6cb7b164-7f9f-465b-a921-2064a18dec0a"/>
                <textElement markup="html">
                    <font fontName="Calibri" pdfEncoding="UTF-8" size="12" isBold="false" isPdfEmbedded="true" pdfFontName="//D:/Calibri.ttf" />
                </textElement>
                <textFieldExpression><![CDATA[$F{capturedImage}==null?$F{formattedNoteData}:""]]></textFieldExpression>
            </textField>
            <line>
                <reportElement positionType="Float" x="0" y="432" width="572" height="1" uuid="0d73a477-c321-4b50-a644-4099ec01bd28">
                    <printWhenExpression><![CDATA[$F{ccList}!=null]]></printWhenExpression>
                </reportElement>
            </line>
            <componentElement>
                <reportElement positionType="Float" x="37" y="436" width="400" height="13" isRemoveLineWhenBlank="true" uuid="7b495409-c1fd-461e-9444-14af83ce993d"/>
                <jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
                    <datasetRun subDataset="dataset1" uuid="ca9177e5-e8f4-4d5c-836e-f0f15aa347b7">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{ccList})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="13" width="400">
                        <textField isBlankWhenNull="true">
                            <reportElement positionType="Float" x="0" y="0" width="375" height="13" isRemoveLineWhenBlank="true" uuid="452d2a0c-6022-43a1-bd94-1ffb38347307"/>
                            <textElement>
                                <font size="6"/>
                            </textElement>
                            <textFieldExpression><![CDATA[$F{ccRow}==null?"":$F{ccRow}]]></textFieldExpression>
                        </textField>
                    </jr:listContents>
                </jr:list>
            </componentElement>
            <staticText>
                <reportElement positionType="Float" x="9" y="436" width="29" height="13" isRemoveLineWhenBlank="true" uuid="eb527dc0-1fb0-4db9-b2b3-be239485d2bc">
                    <printWhenExpression><![CDATA[$F{ccList}!=null]]></printWhenExpression>
                </reportElement>
                <textElement>
                    <font size="6" isBold="true"/>
                </textElement>
                <text><![CDATA[cc :]]></text>
            </staticText>
        </band>
    </detail>
    <pageFooter>
        <band height="24" splitType="Stretch">
            <textField>
                <reportElement x="-6" y="6" width="50" height="13" uuid="6932e2e3-c51f-4871-960a-ccbe735d56c1"/>
                <textElement textAlignment="Right">
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement x="44" y="6" width="40" height="13" uuid="9f7a7f9f-5ec5-4f30-8ace-73ec8cc4b4d6"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
            <textField pattern="MM/dd/yyyy hh:mm:ss a">
                <reportElement x="462" y="5" width="110" height="14" uuid="e0cb9378-bb2c-47b0-b0dd-013ad846a05e"/>
                <textElement>
                    <font size="6"/>
                </textElement>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
</jasperReport>

Here is the screenshot also of the PDF Generated. The text after last line of 1st page is missing and you can see the remaining text on the 2nd page which comes after the missing text.

Text between 2 lines is missing:

Text between 2 lines is missing

What do i do to fix this?

1
Is it really minimal sample to reproduce the issue (looks like a huge template)? How to test it?Alex K
I myself also tested the minimal sample but still i was facing the issue.Nishant Singh
All the content is provided dynamically hereNishant Singh
If jasper is not creating pdf export correctly I would check font-extensions and if it still does not work try to set net.sf.jasperreports.export.pdf.force.linebreak.policy=truePetter Friberg

1 Answers

1
votes

Try using Dejavu sans font instead of Times new roman