Text wrapping in PDF

0

Hi,

We are experiencing a strange problem with text wrapping when saving as a PDF. The print preview is fine.

e.g. ABCDE appears as

ABCD

E

The field is large enough to hold all the required data. If I set the field to be bold or lower-case the data, it appears fine in the PDF.

I've also tried setting the linebreak policy using:

   jp.setProperty("net.sf.jasperreports.export.pdf.force.linebreak.policy", "true");

Currently using JasperReports 4.1.1 and can't update at the moment.

Thanks,

Dave

nockdg's picture
16
Joined: Jan 18 2007 - 4:21am
Last seen: 5 months 2 weeks ago

2 Answers:

0

Probably a problem with pdffont and with pdffont size. Try using smaller pdf font size.

hozawa's picture
64926
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 year 3 months ago
0

I've tried different fonts and sizes and haven't found a combination that works. 

<elementGroup>
	<textField isStretchWithOverflow="true">
		<reportElement positionType="Float" x="0" y="20" width="90" height="18" stretchType="RelativeToTallestObject"/>
		<textElement>
			<font fontName="Calibri" size="11" isBold="true"/>
		</textElement>
		<textFieldExpression class="java.lang.String"><![CDATA["Status:"]]></textFieldExpression>
	</textField>
	<textField isStretchWithOverflow="true">
		<reportElement positionType="Float" x="100" y="20" width="400" height="18" stretchType="RelativeToTallestObject"/>
		<textElement>
			<font fontName="Calibri" size="11" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
		</textElement>
		<textFieldExpression class="java.lang.String"><![CDATA["ABCDE"]]></textFieldExpression>
	</textField>
</elementGroup>

The report consists of about 15 rows of data formatted as above. The problem only occurs with a couple of fields and the only difference I can see is that the data has a higher proportion of capital letters.

The fields in each row are all exactly the same size. Some rows have much longer data and that all displays fine in the pdf.

Thanks

Dave

nockdg's picture
16
Joined: Jan 18 2007 - 4:21am
Last seen: 5 months 2 weeks ago
Feedback