Jump to content

Macrons not displayed in Java Application


prashanth.talkad

Recommended Posts

Hi,

I'm facin an issue where Maori Macrons are getting displayed on my reports when I run it in JasperServer(v ) and in iReport(v ). I have a java Interface with code to interact with JasperServer via webservices calls provided by the jasper server.

The moethod -

public JasperPrint generateReport(String reportUri, Map parameters) throws Exception {      
        ResourceDescriptor resourceDescriptor = new ResourceDescriptor();
        resourceDescriptor.setWsType(ResourceDescriptor.TYPE_REPORTUNIT);
        resourceDescriptor.setUriString(reportUri);
        JasperPrint generatedJP = null;
        WSClient wsClient = jasperServer.getWSClient();
        if (wsClient != null) {
            generatedJP = wsClient.runReport(resourceDescriptor, parameters);
            boolean emptyPages = generatedJP.getPages().isEmpty();
        } else {
            new SystemException("A WSClient instance is not available.");
        }
        return generatedJP;
    }

 

And the returned JasperPrint object is converted into pdf using -

JasperExportManager.exportReportToPdfFile(report, pdfFile.getAbsolutePath());

This is where the problem is - the pdf report that is rendered DOES NOT CONTAIN MAORI MACRONS!!!

As mentioned earlier, the macrons are visible when I run it from iReport(with connection to server) and from the jasper server itself.

Any help in pointing to the right direction to get this working is appreciated.

cheers

p

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

hi - a quick update . in the JRXML, I've got a text field as below -

 

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

<reportElement

x="9"

y="25"

width="523"

height="12"

key="textField-7"/>

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

<textElement>

<font fontName="Times-Roman" size="10" pdfFontName="C:\WINDOWS\FONTS\ARIALUNI.TTF" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA[$F{V_PERSON_ADDRESSING_NAME}]]></textFieldExpression>

</textField>

 

If in the above field definition I change the pdfFontName to "repo:ARIALUNI.TTF" and upload the font onto jasperserver, the java application throws an exception -

Caused by: net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font :

pdfFontName : repo:ARIALUNI.TTF

pdfEncoding : Identity-H

isPdfEmbedded : true

at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:1691)

at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1600)

at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1583)

at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1908)

 

 

If the hardcoded path is in the field definition, it would like a charm. The java app I'm talking about it a web application and the user needs to open the pdf's to view the macrons.

 

thanks,

p

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