1
votes

I'm developing a Jasper report that has to be exported as a PDF from my web app. The jasperreport.version is 5.5.1 and the web app is running on a Tomcat6 instance.

I've defined the following elements in my .jrxml:

<rectangle>
    <reportElement positionType="Float" stretchType="RelativeToTallestObject" mode="Transparent" x="415" y="21" width="140" height="28" uuid="52ceec4a-26bb-4efa-a4d2-af32c107d1d3"/>
    <graphicElement>
        <pen lineWidth="0.5"/>
    </graphicElement>
</rectangle>
<textField isStretchWithOverflow="true">
    <reportElement style="label" positionType="Float" x="415" y="20" width="140" height="14" uuid="f1394c5b-4921-4ccd-84ed-b1d3e44dc499"/>
    <textElement markup="none">
        <font size="9" isBold="true" isItalic="false"/>
    </textElement>
    <textFieldExpression><![CDATA[$R{nivel.gestao}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
    <reportElement style="campo" positionType="Float" stretchType="RelativeToTallestObject" x="415" y="34" width="140" height="15" uuid="3e1d2402-8b21-4f8e-9ee8-d57f1a870077"/>
    <box bottomPadding="2"/>
    <textElement verticalAlignment="Middle" markup="none">
        <font size="9" isBold="false"/>
    </textElement>
    <textFieldExpression><![CDATA[$P{nivelGestao}]]></textFieldExpression>
</textField>

The problem is that Jasper renders the text with line breaks depending on which font family I use.

Using Helvetica:

text using Helvetica (the undesired font)

Using Courier (the font I need):

text using Courier (the font I need)

How can I use the Courier font family and avoid the unintended line breaks?

1

1 Answers

0
votes

Text with Courier font is wider. I suppose if you write some long text with Helvetica you see same stuff. Check out padding and margins.

And remove <box bottomPadding="2"/>.