Pdf report with Unicode font

We are using Unicode font, fetching data from
postgres and displaying through iReport.
I have set pdf fontname='Lohit Tamil', font name ='lohit tamil',
and Pdf encoding as Identity-H(unicode with Horizontal writing)
I have tried with iReport-1.2.0 and iReport-2.0.2 versions.


The report is coming properly in JRViewer, Firefox etc. but
display is not proper in pdf

I need a solution.

Partha
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago

I have used Akshar Unicode font, with this you can export PDF through iReport Designer but it get fail in Browser to open PDF. 

sachin.manjule_1 - 8 years 6 days ago

26 Answers:

Hi --

Have you tried setting isPdfEmbedded=true so that the font is included with your PDF file?


betty
itchytoes's picture
1981
Joined: Jan 12 2007 - 3:58am
Last seen: 16 years 5 months ago
Yes. I have set isPdfEmbedded=true.
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago
Hi --

Are you using a font file , and if so, what is it called? I've been able to use the unicode fonts from
ARIALUNI.TTF without any problems. I set pdfFontName="ARIALUNI.TTF" pdfEncoding="Identity-H" and isPdfEmbedded="true".

Betty
itchytoes's picture
1981
Joined: Jan 12 2007 - 3:58am
Last seen: 16 years 5 months ago
Hi --

I downloaded a freebie Akshar.ttf font file from some site and tried it out with the FirstJasper.jrxml sample and it works fine. I specify pdfFontName="Akshar.ttf" and put the Akshar.ttf in the classpath

Betty
itchytoes's picture
1981
Joined: Jan 12 2007 - 3:58am
Last seen: 16 years 5 months ago
I have used lohit_ta.ttf font which is a tamil unicode font. I have included the font folder in the classpath. [file name=districtrep.jrxml size=3869]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/dis...
Post edited by: partha99, at: 2007/12/11 05:23
Post edited by: partha99, at: 2007/12/11 05:25
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago
Hi -

I looked at your uploaded example, and I tried something very similar to imitate it with the FirstJaspser sample but it worked for me (using my Akshar.ttf font file)

So, what do you see instead of the correct Tamil characters? Here's what I suggest trying as an experiment. Instead of printing your $F{dist_name_t} data, just put the string "\u0b90\u0bb0" which are two valid unicde Tamil characters. See if they appear correctly.

Betty
itchytoes's picture
1981
Joined: Jan 12 2007 - 3:58am
Last seen: 16 years 5 months ago
Dear Betty,

Thanks for your good suggestion.

Checked with directly inputting unicode values in text field in iReport.
They display properly in pdf output also.

when retrieved from the database certain combination character
like unicode values like u0b90,u0bb0. combination of consonant and vowels.
are not displayed properly in pdf output only
whereas jrviewer and html gives proper output.

Iam using postgres 7.4 with UTF-8 encoding.
storing the data using ISO--8859-1 encoding
retrieving the data using UTF-8 encoding

if i store and retrieve using UTF-8 it stores only junk and displays junk.

expecting further suggestions please.

K.Parthasarathy
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago
Hi --

I'm afraid now your problem is outside of my knowledge base. I've only used the unicode characters for their symbols, so my reports have just contained the strings with the hex representation of the characters. I've never tried display data from a database that has special characters. Also, I've never used postgresSQL-- we use oracle and mysql here. Otherwise, I'd play with with a simple example.

My first suggestion is to make sure that your tamil characters made it into your DB correctly. One simple thing you can do is run a simple JDBC program to read the data back into java String and just dump out the unicode characters of the String to be sure that Java reads the data correctly and you get the unicode that you expect. Then, you can deal with jasper issues after that.

Betty
itchytoes's picture
1981
Joined: Jan 12 2007 - 3:58am
Last seen: 16 years 5 months ago
Hi,

Looking at the report sample you posted, I can tell that you are not using isPdfEmbedded="true". I think you should, otherwise you are counting on the tamil font to be installed on the system where you view the PDF. This is probably not the case, hence the problem.
Also, make sure you use the pdfFontName attribute also in the styles, your default style there does not use it.

I hope this helps.
Teodor
teodord's picture
47352
Joined: Jun 30 2006 - 9:00am
Last seen: 20 hours 40 min ago
I have checked with ispdfEmbedded=true option also.

In tamil the typing sequence is different from the display format.
In display consonants and vowels combine and display as a single letter whereas they are 2 different keystrokes.

The database displays in proper format when queried using query tool.
When the value is extracted using a jsp program it gives
unicode literal values they are as per typing sequence.

This is properly hanlded by browsers like firefox with pango support and Konqueror.
when i type in Openoffice writer and convert to pdf it does properly.
I feel the support is not there is itext which ireport used for pdf conversion for handling indian languages.
Is there any other utility like itext which can generate pdf from ireport with proper display
or is there any plugin for itext to handle this.
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago
Hi,

You mean it is about text run direction: right-to-left and left-to-right mixed writing?
I think iText is pretty good when it comes with text direction, as far as I know.
It would be helpful if you could post some relevant files here, like JRXML with hardcoded text fields and resulting PDF, as well as a screenshot of the correct output.

Thank you,
Teodor
teodord's picture
47352
Joined: Jun 30 2006 - 9:00am
Last seen: 20 hours 40 min ago
partha99 wrote:
I feel the support is not there is itext which ireport used for pdf conversion for handling indian languages.
Is there any other utility like itext which can generate pdf from ireport with proper display
or is there any plugin for itext to handle this.


I found [url=http://article.gmane.org/gmane.comp.java.lib.itext.general/18135/match=t... apparently related psot on the iText forum. Quoting from the post:
the words in some languages, like Hindi are spelled wrong.
This is because iText shows you the characters as they appear in the XML.
iText doesn't do ligaturizing for Indic languages, only for Arabic.
(If somebody feels like writing an IndicLigaturizer, I'd be happy to add it to iText.)


The post is from two years ago but I couldn't find any indication that this has been fixed in the mean time.

If this is the problem you are describing, then I don't think there's anything you can do to make it work in iReport. The only way of producing PDF output with JasperReports is by using the iText-based PDF exporter.

Regards,
Lucian
lucianc's picture
77046
Joined: Jul 17 2006 - 1:10am
Last seen: 1 hour 7 min ago
Hi,
Iam attaching the jrxml and screenshots in html and pdf generated with iReport.
Iam able to generate pdf from openoffice writer properly.
Since both are opensource community can the solution be obtained for itext from openoffice.

Partha
[file name=unicodepdftest.zip size=36087]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/uni...
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago
Hi,

If two products are both open source, it does not mean they work the same. They are two different products, developed by different people, using totally different technologies. The fact that it works for you in OpenOffice, is completely irrelevant to why it does not work in iText.

In any case, this is not something we can help with at this point. You should consider posting this on the iText discussion forums and mailing lists.

Thanks,
Teodor
teodord's picture
47352
Joined: Jun 30 2006 - 9:00am
Last seen: 20 hours 40 min ago
Thanks to you all. I will post the issue to itext forum as suggested.

Partha
partha99's picture
796
Joined: Dec 2 2007 - 2:00pm
Last seen: 15 years 6 months ago
I have a similar issue with Maori Macrons - I am running a report with the code below for a field that needs to display Maori Macrons. It displays fine within JRViewer, and its fine when I export it to word or excel, but craps out when I export to PDF. I've pasted my code below for that field. Any suggestions welcome. Also, iReport documentation conatains a sentence that says that they have a rich set of encoding types, but which one is best to use for Unicode? I see a Identity-H and -V which does not solve the problem. Also, all fields in my report are consistent in terms of the PDF encoding and PDF font and PDF embedded values.
prashanth.talkad's picture
Joined: Feb 4 2008 - 8:58am
Last seen: 15 years 4 months ago

The problem is with the PDF font u have selected. Please select a font having a unicode characters. For example Arial_UnicodeMS. You want find this in the normal list of PDF fonts. But you can set the "windows fonts" path in the classpath of iReport. After doing this you will get this font name. Try one of the Identity-H or Identity-V. it will work wonders. Please see the attachement. In your case the Tamil fonts need to be in Unicode. Only then can u see the fonts correctly in pdf. But i feel Tamil by default will be unicode.

shrije's picture
2345
Joined: Apr 5 2008 - 8:59am
Last seen: 9 years 2 months ago

I have tried your font and it works fine with me. Make sure you have set the UTF-8 in report properties.

shrije's picture
2345
Joined: Apr 5 2008 - 8:59am
Last seen: 9 years 2 months ago

Even the one you sent works. See the attachement

shrije's picture
2345
Joined: Apr 5 2008 - 8:59am
Last seen: 9 years 2 months ago

Hi the same pbm coming for me too. I have filled all that info which was mentioned on this previous posts . But still that tamil font on PDF is not coimng properly .Pls give the correct info about this.

 

By

Raja Mani

Junior Research Fellow

India

teodord
Wrote:
 

Hi,

Looking at the report sample you posted, I can tell that you are not using isPdfEmbedded="true". I think you should, otherwise you are counting on the tamil font to be installed on the system where you view the PDF. This is probably not the case, hence the problem.
Also, make sure you use the pdfFontName attribute also in the styles, your default style there does not use it.

I hope this helps.
Teodor
raja38's picture
137
Joined: Dec 31 2008 - 2:03am
Last seen: 14 years 5 months ago

Please check if your XML encoding is UTF-8.

shrije's picture
2345
Joined: Apr 5 2008 - 8:59am
Last seen: 9 years 2 months ago
Hi, We are happy to release a version of Jasper Reports enabled for Complex Scripts Support in PDF export. This include languages under Indic Scripts like Hindi, Tamil, Bengali, Gujarati, Kannada and others. It also includes support for scripts like Sinhalese and Thai. It is based using OpenOffice as a PDF generating agent and API and does not use iText. Please download it from http://202.141.136.157/bharateeyaoo/jasper.shtml Have a great day. Best Regards -RKVS Raman
rkvsraman's picture
137
Joined: May 5 2009 - 2:58am
Last seen: 14 years 1 month ago

Hi,

We are happy to release a version of Jasper Reports enabled for
Complex Scripts Support in PDF export. This include languages under
Indic Scripts like Hindi, Tamil, Bengali, Gujarati, Kannada and
others. It also includes support for scripts like Sinhalese and Thai.

It is developed using OpenOffice as a PDF generating agent and API and
does not use iText.

Please download it from http://202.141.136.157/bharateeyaoo/jasper.shtml

Have a great day.

Best Regards
-RKVS Raman

rkvsraman's picture
137
Joined: May 5 2009 - 2:58am
Last seen: 14 years 1 month ago
<font fontName="Mangal" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="C:\\Windows\\Fonts\\Mangal.TTF" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

just give the path of ttf in font tag. and must ser isPdfEmbede=true.
Thanx.
anyone's picture
237
Joined: Jul 22 2010 - 6:22am
Last seen: 12 years 10 months ago


SOLUTION FOR TAMIL REPORTS AND PDF IN TAMIL

I used LE-ET-Ramya(etramya.ttf) Tamil Font For Tamil Reports

set pdfFontName="etramya.ttf" and isPdfEmbedded ="true" for user tamil field $F{TamilName}

we can store data in table and reterive directly from table and display reports in pdf/html/ODF file in tamil is working.

in servlet to work for particular jrxml field set pdffontname with font store location path
eg:
pdfFontName="font/etramya.ttf"

To download font http://www.elcot.in/tamilfonts_download_list.php

any query come forward free to ask

Thanks and Regards,
karthikeyan
 

Attachments: 
AttachmentSize
Binary Data tamilreports.jrxml3.69 KB
karthikeyanyeds's picture
Joined: Aug 21 2013 - 11:39pm
Last seen: 9 years 5 months ago


 

Attachments: 
AttachmentSize
Binary Data tamilreportswithparameter.jrxml4.59 KB
karthikeyanyeds's picture
Joined: Aug 21 2013 - 11:39pm
Last seen: 9 years 5 months ago
Feedback