Jump to content
Changes to the Jaspersoft community edition download ×

Markup doesn\'t work exporting to PDF in Linux


reggie

Recommended Posts

First of all, I should say that I am using JasperReports 3.6.1.

The situation is the following: I create a JasperReport using IReport in Windows. This report uses a TextField with markup = html. I made a fonts extension jar as I saw in the sample of the JasperReport project, and it works perfectly if I deploy the application in a Windows Server. When I deploy the application in a Linux server and I generate the report, it doesn't take the font that I have specified in the textfield.

First of all I checked in the log server if fonts are loading or not. Application loads the fonts:

[2/26/10 13:09:43:791 CET] 0000001d XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from URL [wsjar:file:/PATH/WEB-INF/lib/jasperreports-fonts-3.6.1.jar!/net/sf/jasperreports/fonts/fonts.xml]

 

This is the text that I set in the TextField:

<p style="text-align:left"><span style="font-family:Georgia; font-size:14px; color:#000000;  "><B>TEXT</B> </span></p>

but the text is not displayed in Georgia bold font. (If the application is in a Windows Server, it is displayed correctly)

If I set directly the fontName in IReport, it exports correctly the PDF in Linux:

            <staticText>
                <reportElement key="staticText-77" x="80" y="24" width="122" height="17"/>
                <textElement>
                    <font fontName="Georgia" size="14" isBold="true" isStrikeThrough="false"/>
                </textElement>
                <text><![CDATA[Oferta nº:]]></text>
            </staticText>

 

There is something wrong with markup and Linux? Am I missing something?

Any help would be appreciate :)

I attach my fonts.xml, maybe the problem is there....

Code:
<?xml version="1.0" encoding="UTF-8" ?> - <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">- <bean id="arialFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">  <property name="name" value="Arial" />   <property name="normal" value="net/sf/jasperreports/fonts/arial/arial.ttf" />   <property name="bold" value="net/sf/jasperreports/fonts/arial/arialbd.ttf" />   <property name="italic" value="net/sf/jasperreports/fonts/arial/ariali.ttf" />   <property name="boldItalic" value="net/sf/jasperreports/fonts/arial/arialbi.ttf" />   <property name="pdfEncoding" value="Identity-H" />   <property name="pdfEmbedded" value="true" />   </bean>- <bean id="courierFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">  <property name="name" value="Courier New" />   <property name="normal" value="net/sf/jasperreports/fonts/courier/cour.ttf" />   <property name="bold" value="net/sf/jasperreports/fonts/courier/courbd.ttf" />   <property name="italic" value="net/sf/jasperreports/fonts/courier/couri.ttf" />   <property name="boldItalic" value="net/sf/jasperreports/fonts/courier/courbi.ttf" />   <property name="pdfEncoding" value="Identity-H" />   <property name="pdfEmbedded" value="true" />   </bean>- <bean id="georgiaFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">  <property name="name" value="Georgia" />   <property name="normal" value="net/sf/jasperreports/fonts/georgia/georgia.ttf" />   <property name="bold" value="net/sf/jasperreports/fonts/georgia/georgiab.ttf" />   <property name="italic" value="net/sf/jasperreports/fonts/georgia/georgiai.ttf" />   <property name="boldItalic" value="net/sf/jasperreports/fonts/georgia/georgiaz.ttf" />   <property name="pdfEncoding" value="Identity-H" />   <property name="pdfEmbedded" value="true" />   </bean>- <bean id="timesFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">  <property name="name" value="Times New Roman" />   <property name="normal" value="net/sf/jasperreports/fonts/times/times.ttf" />   <property name="bold" value="net/sf/jasperreports/fonts/times/timesbd.ttf" />   <property name="italic" value="net/sf/jasperreports/fonts/times/timesi.ttf" />   <property name="boldItalic" value="net/sf/jasperreports/fonts/times/timesbi.ttf" />   <property name="pdfEncoding" value="Identity-H" />   <property name="pdfEmbedded" value="true" />   </bean>- <bean id="verdanaFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">  <property name="name" value="Verdana" />   <property name="normal" value="net/sf/jasperreports/fonts/verdana/verdana.ttf" />   <property name="bold" value="net/sf/jasperreports/fonts/verdana/verdanab.ttf" />   <property name="italic" value="net/sf/jasperreports/fonts/verdana/verdanai.ttf" />   <property name="boldItalic" value="net/sf/jasperreports/fonts/verdana/verdanaz.ttf" />   <property name="pdfEncoding" value="Identity-H" />   <property name="pdfEmbedded" value="true" />   </bean>  </beans>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi reggie,

   I have defined markup text in this way and works on Windows and Linux, perhaps you are missing the pdfFontName attribute:

<text><![CDATA[bold, italic and underlined text: <style isBold="true" isItalic="true" isUnderline="true" pdfFontName="Helvetica-BoldOblique">www.ssn.gov.ar</style>]]></text>

    Is true that I' using regular fonts, but with embebed fonts must works fine too.

grettings.

 

 

 

 

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