Jump to content

Maori Macrons in iReport


prashanth.talkad

Recommended Posts

hi,

I have my java application trying to display names of persons and their addresses.

The query in my iReport picks up data from a database that supports "nvarchar", thereby supporting Maori Macrons(UTF-8 enconding in other words). But when I try to display the same in the report I desuigned using iReport, the macrons get eaten up and the reminder of the name is shown.

For example::: if the name is DÅnnÄ

, the report displays only "Dnn". Am using java.lang.String to display the names and heres how my field looks in the iReport.

 

<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        x="74"
                        y="66"
                        width="188"
                        height="15"
                        key="textField-27"/>
                    <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
                    <textElement>
                        <font/>
                    </textElement>
                <textFieldExpression   class="java.lang.String"><![CDATA[$F{V_PERSON_ADDRESSING_NAME}]]></textFieldExpression>
                </textField>

The header of my JRXML reads :::

<?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">
 

can anyone help me on this one please.

thanks,

p

Link to comment
Share on other sites

  • Replies 16
  • Created
  • Last Reply

Top Posters In This Topic

I think this is actually a font issue. I have similar problems with non-ASCII characters. As far as I can tell, you should make sure both the display font and the PDF font (different) have the necessary characters. This can also involve adding some font directories to the paths.

 

Good luck.

Link to comment
Share on other sites

I'm made sure all fields in my report have the same values for PDF FONT, PDF EMBEDDED and PDF ENCODING respectively as "Helvetica", "checked" and "CP1252". Surprising that I do not find any UNICODE encoding type in the list (though there is a Identity-H and Identity-V, which unfortunately dont work and throws exceptions at runtime.)
Link to comment
Share on other sites

prashanth,

I think the key part of the problem is your comment "there is a Identity-H and Identity-V, which unfortunately dont work and throws exceptions at runtime".

 

Identity-H should work well for Unicode. Figuring out why it's not working for you will probably solve your problem. Using CP1252 as you've indicated is definitely not going to work. It handles ASCII, but not most Unicode characters.

 

This post regarding PDF generation for Japanese characters may be a good starting point:
http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=45569#46629

 

Regards,
Matt
Jaspersoft

Link to comment
Share on other sites

Thanks Matt.

Here's what I did in JasperServer(the install directory) -

1. added fonts ARIALUNI.TTF, ARIAL.TTF into the iReport\fonts folder.

2. I have a tomcat base to which I deploy jasperserver.war - I edited the pdfFontBeans.xml to include font references to the fonts placed in the iReport\fonts folder mentioned in 1.

I ran the report from teh web interface of JasperServer and used the "PDF Export" button as in the snapshot below: this works now !! thats a step ahead. But my java application that interfaces with JasperServer and calls the same report and reads the PDF back into the client browser fails with an exception::: :(

Could not load the following font :


pdfFontName   : ARIALUNI.TTF
pdfEncoding   : Identity-H
isPdfEmbedded : true

To get this to work in JRViewer, I had loaded the fonts ARIALUNI.TTF, arial.ttf in to the "iReportFonts" folder under the JasperServer install folder. This means that the Jasper Server now packages the font into the PDF export. Are there any other settings I need to do for this to work with my application. Since my application is just using the JasperServer API to get JasperPrint pbjects, I thought that it should work on its own if it wokrd on JasperServer. But thats not the case.

I'm lost !!!

Is there something I'm missing here?

thanks,

p

Link to comment
Share on other sites

prashanth,

I think the last piece remaining for you is that you need to load the font into JasperServer. Don't copy it into a folder in the tomcat install, but instead load it into JasperServer like you would upload an image or a JRXML file. Then in the report unit add the font as a resource.

 

Then in the report you'll need to change the font from "ARIALUNI.TTF" to "repo:ARIALUNI.TTF".

 

Does the idea make sense? Once you use the repo syntax then JasperServer should be able to locate the font that it needs to include in the PDF.

 

Regards,
Matt
Jaspersoft

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

It appears there is a very simple solution to the PDF fonts issue.

In iReports you need to type the full path to the font in the PDF font field.

Such as "/windows/fonts/arial.ttf" (forward slashes even on Windows).

You will need to make sure that the font location on your production platform is the same as on your development platform.

I was having problems with Greek and using this solution solves the problem completely.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...

Hi, I am having problem in displaying japanese charecters, I am exporting as pdf but its displaying japanese font how it is stored in data base but not displaying japanese charecters Please help me where should i need to add fonts and how.

Thanks in advance.

Link to comment
Share on other sites

Hi i am installed Ireport 3.1.3 . I am using mysql database in that one field stores japanese charecters while generating report with that field its not displaying japanese charecters instead displaying font how its stored in data base Please tell me how to display japanese charecters.

Please see the attached file to see how its displaying.

Please help me to solve this issue.send any help to kotresh.chikkabidari@datafarm.com ot meetkotresh.gmail.com

Thanks in advance.

Kotresh.

 

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