Jump to content

Pdf report with Unicode font


partha99

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

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 "u0b90u0bb0" which are two valid unicde Tamil characters. See if they appear correctly.

 

Betty

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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/unicodepdftest.zip[/file]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 9 months later...

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.

 

x="9"

y="25"

width="523"

height="12"

key="textField-7"/>

$F{V_PERSON_ADDRESSING_NAME}

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...

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
Link to comment
Share on other sites

  • 4 months later...

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 1 year later...

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

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