Jump to content
Changes to the Jaspersoft community edition download ×

Linux pdf report with Courier font truncates text


vipinkumar

Recommended Posts

Hi, I am facing text truncation problem on page breaks when I generate a pdf report which spans multiple pages from Linux server. The report has only single text field which can span multiple pages. I have to use Courier font otherwise formatting of my text is not preserved. The report runs okay on windows but truncates 1 lines on the bottom of each page when I run from Linux. Here are my textfield and font settings.

<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

 

<reportElement mode="Transparent" x="0" y="0" width="535" height="760" key="textField" stretchType="RelativeToTallestObject" positionType="Float" isPrintRepeatedValues="false" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="false"/>

 

<font fontName="Courier New" pdfFontName="Courier" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="true" pdfEncoding ="cp1252" isStrikeThrough="false"/>

 

I copied all .ttf files from windows fonts to a Linux directory and set the JAVA_FONTS environment variable to point to the local font directory. I tried the below, stil the same result -

<font fontName="cour.ttf" pdfFontName="cour.ttf" size="8" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="true" pdfEncoding ="cp1252" isStrikeThrough="false"/>

 

I have read a lot of threads saying its a font problem between pdf and awt. I guess setting JAVA_FONTS should ensure that Linux JVM has all the fonts from the local directory. I am not sure why it is still truncating the text. I have to use Courier font only. I even copied all fonts(*.ttf) files under ../jre/lib/fonts but problem is not resolved.

Please can anyone help me with a solution.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

Are you sure that a physical or logical font with the name "Courier New" is available to the JVM?

The best way to test this is to display with a small program all the fonts available to the JVM by calling

GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Yes, I have "Courier New" available to JVM. I printed all fonts and it shows all 138 fonts which I copied from windows.

The problem exists on windows as well if I use font size other than 8. I am not sure if I am doing anything wrong.

For the time being I am splitting the whole text into pages of text(say 74 lines per page) and creating as many objects as number of pages and then passing an array of these objects to jasper to fill the report.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...