Jump to content
Changes to the Jaspersoft community edition download ×

Diference in PDF layout from Windows and Linux


Recommended Posts

Developed one report in a Windows workstation and the report is OK. The report was generated using iReport 1.2.7. With only 35 records in the detail section, it fits in one page.

Developed a simple Servlet to run the report and export it to PDF. The PDF is served back to the browser. The servlet works Ok in Windows. The whole report fits in one page. If the same report, now part of a war file, is executed on a Linux server it places extra space below every detail line. The report now takes 2 pages.

2 sample PDF. One was generated from the Windows workstation and the other one from the Linux server. As you can notice, the version generated on the Windows workstation fits in one page. The one generated on Linux has extra space below every detail line.

Any idea what is causing the extra space below the detail?

Link to comment
Share on other sites

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic



This looks like a typical font issue.

Make sure the fonts you are using in your report template are available on both systems.

I suspect you use in your report a Windows font such as Arial, which is not available on Linux and gets replaces with some other default font having different font metrics.


I hope this helps.


Link to comment
Share on other sites

  • 2 weeks later...

Hey guys!


Well, I've got the same problem with the same iReport version using jasperreports-1.2.7-javaflow.jar on Linux within both, a command-line-application and a JBoss-server-webapp.


The detail-band-fields are enlarged on Linux in their height by - it seems to be - exactly one line-height (line-spacing + font-height). I tried to put a colored frame around to see this... Stretch-type: "Relative to tallest object", font-size 8px, top-/bottom-padding 2px, field-height 16px.


I embedded our company's corporate-design-fonts into the PDFs and provided the TTFs in the classpath. They are correctly embedded, which I can see in Adobe Reader.


The fonts are displayed correctly. But Adobe means there is also a Helvetica-font inside the PDF, which we don't use in no report or subreport. I also put the Helvetica-fonts onto my classpath, but it is not being displayed as embedded by Adobe and it has no effect.




Might this be the problem? I hope Helvetica is not being used by JasperReports to render the lines or field-paddings :blink:


If you have any idea, so please tell me and I will try it :)







Post edited by: eztup, at: 2006/11/13 12:15

Post edited by: eztup, at: 2006/11/13 14:11

Link to comment
Share on other sites



I still think you have a font problem related to the use of the pdfFontName, isPdfEmbedded and pdfEncoding attributes.

I suspect you do not set them properly for those text fields.


I would try to isolate on text field with the problem by removing all others and see why it does not used the correct font settings.


Posting a simplified version of the JRXML here would help.


I hope this helps.


Link to comment
Share on other sites



I see your report template has 6 report fonts defined, but none of them is marked as default.

So the engine will use a default that is defined in the engine itself and uses Helvetica.

This engine default font applies to text fields for which you did not mention a report font to use.


Note that report fonts are now deprecated and report styles should be used instead.


I hope this helps.


Link to comment
Share on other sites

Hi! Thanks for your hints. But...

- I defined a report-font as default and it had no effect on my problem.

- I replaced all report fonts by styles and set one to default and it had no effect on my problem

- I deleted all text-fields and let only graphics inside the report, deleted all subreports, and the Helvetica-font was still displayed in PDF-properties in Adobe Reader.

- I deleted the report, created a new and empty with only one text-field giving it a default style... and there it worked. There was no emtpy-space when the field has been stretched to tallest object. But the Helvetica-font was still displayed in PDF-properties in Adobe Reader, even if not set in field's properties -.-

BTW: Did I mention that if my fields contain short data not causing line-breaks, the empty-space is not being displayed? Remembering that, I tried kicking the single fields with long Strings that cause line-breaks - and guess what: the right field in detail band was the guilty one!!! I tried making it some pixels wider and now it works! The blank lines have vanished and only the records with data causing line-breaks are higher than the ones with short Strings :woohoo:

It's not 100% the same layout on Linux than under Windows, but nearly - and this is enough for us B)

So thx a lot again!
Post edited by: eztup, at: 2006/11/17 11:01

Link to comment
Share on other sites

  • 1 year later...

I am having the same problem. I seems get a extra spacing/line in my pdfs in Linux.


I have Arial Font in my classpath.When I remove it , it is complaining. So I am pretty sure it is using it.


My jrxml for the report and subreport attached [file name=permit.jrxml size=75517]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/permit.jrxml[/file]


The following is my subreport -

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

















<property name="ireport.scriptlethandling" value="0" />

<property name="ireport.encoding" value="UTF-8" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />


<parameter name="totalCount" isForPrompting="false" class="java.lang.Integer"/>

<queryString><![CDATA[select PROVISION_DETAIL_Txt as "text" from permit_provision

where permit_id = 5604741]]></queryString>


<field name="text" class="java.lang.String"/>


<variable name="rowCount" class="java.lang.Integer" resetType="None" calculation="Count">

<variableExpression><![CDATA[new Integer(1)]]></variableExpression>



<band height="0" isSplitAllowed="true" >




<band height="0" isSplitAllowed="true" >




<band height="0" isSplitAllowed="true" >




<band height="0" isSplitAllowed="true" >




<band height="30" isSplitAllowed="true" >

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
















<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" isStyledText="true" lineSpacing="Single">

<font fontName="Arial" pdfFontName="ARIAL.TTF" size="12" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />


<textFieldExpression class="java.lang.String"><![CDATA[$P{totalCount}.intValue() > 1 ? $V{REPORT_COUNT}.toString() + ". " + $F{text}: $F{text}]]></textFieldExpression>





<band height="0" isSplitAllowed="true" >




<band height="0" isSplitAllowed="true" >




<band height="0" isSplitAllowed="true" >




Link to comment
Share on other sites

  • 2 weeks later...

I am having exactly this same problem. I am using windows fonts (arial.ttf, arialbd.ttf, times.ttf timesbd.ttf and so on). I have developed reports under windows where they work fine and they have layout/spacing issues when being generated on a linux server.



I've found that putting the ttf files in the classpath is not enough. In opensuse, if I install these ttf fonts in the /usr/share/fonts directory (and run fonts-config) suddenly the reports start looking like windows. I also found that I can install put these fonts in the jvm/fonts directory and the reports will also output exactly like windows.



As posters above, I am fairly confident that my report is using these fonts because it complains and fails when they are not in the classpath.



This really looks like a sizing or spacing issue. When the linux reports are generated, it looks like there is plenty of space to fit text that is getting cut off etc..



Oddly enough, I noticed that if I open my jrxml file in iReport under opensuse, I get exactly the same spacing problems that I see in my pdfs.



What is the cause of this? Is this an issue of jasperreports doing sizing and layout with the "regular" font and only iText using the pdf font?



Any help with understanding this situation would be greatly appreciated!



I should also mention I do not have the mscore fonts installed.

Post edited by: farleigh, at: 2007/11/30 19:59

Link to comment
Share on other sites

  • 2 years later...

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...