jasper-reportsexport-to-pdf

Static text cutting off while exporting reports to pdf in Linux Deployments using Jasper Reports


We have static text cutting while exporting reports to pdf in Linux Deployments. The values seems to be displayed correctly only the static text is cut off. Below is the screenshot for report pdf in Windows and Linux Deployments.

Any help or input would be really appreciated.

Report on Linux region Screenshot from Linux for report

Report in Windows Screenshot from Windows for report

<style name="Base" isDefault="true" fontSize="8"  pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="true"/>

Code for Status field

 <staticText>
      <reportElement positionType="Float" x="0" y="11" width="29" height="11" forecolor="#000000" uuid="33ebd0e4-a138-4a26-943e-a7c1b23fd5ed"/>
      <textElement>
           <font isBold="true"/>
                    </textElement>
                    <text><![CDATA[Status: ]]></text>
                </staticText>
                <textField>
                    <reportElement x="29" y="11" width="140" height="11" forecolor="#000000" uuid="465caf4d-66e7-412f-81f3-02349696cfc0"/>
                    <textFieldExpression><![CDATA[$P{claimStatus}]]></textFieldExpression>
                </textField>

Loss Description

<frame>
                <reportElement positionType="Float" x="0" y="33" width="473" height="11" isRemoveLineWhenBlank="true" forecolor="#000000" uuid="2fc22d18-89c7-4b7c-a583-ca4f7acd2344">
                    <printWhenExpression><![CDATA[$P{lossDescription} != null && $P{lossDescription}.length() > 0]]></printWhenExpression>
                </reportElement>                
                <staticText>                
                    <reportElement positionType="Float" x="0" y="0" width="69" height="11" isRemoveLineWhenBlank="true" forecolor="#000000" uuid="70d296f8-0869-4ecf-bf57-a6bdc50366de" backcolor="blue">
                        <printWhenExpression><![CDATA[$P{lossDescription} != null && $P{lossDescription}.length() > 0]]></printWhenExpression>
                    </reportElement>
                    
                    <textElement>                        
                        <font isBold="true"/>
                    </textElement>
                    <text><![CDATA[Loss Description: ]]></text>
                </staticText>
                <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                    <reportElement positionType="Float" x="69" y="0" width="368" height="11" isRemoveLineWhenBlank="true" forecolor="#000000" uuid="7318184a-2d1a-4c75-aaf7-e5c2609e7d92">
                        <printWhenExpression><![CDATA[$P{lossDescription} != null && $P{lossDescription}.length() > 0]]></printWhenExpression>
                    </reportElement>                   
                    <textFieldExpression><![CDATA[$P{lossDescription}]]></textFieldExpression>
                </textField>
            </frame>

Solution

  • In order to resolve it, we included the Arial font in jasper-font jar and changed the font from Helvetica to Arial in reports.

    Once done, Reports started rendering fine in Linux and Windows region since Arial font TTF files were part of the war thru jasper-font jar.