Page 1 of 1

UnsupportedEncodingException in Jasper Reports

PostPosted:Sun Sep 16, 2012 3:49 pm
by noxious
Hello, I'm using iReport designer 3.5.6 to create jrxml reports for my okm application.
I had a problem in creating pdf reports with UTF-8 characters but after a lot of googling I found out that I had to import Arial Unicode MS font in my ireport designer with pdfEncoding=Identity-H. Then, when I have to display a UTF-8 text,
I just write:
Code: Select all
<font fontName="Arial Unicode MS" size="22" isBold="true" isPdfEmbedded="true" pdfEncoding="Identity-H"/>
Everything works perfect when I use iReport's default host but when I try to run the report using OpenKM, I get UnsupportedEncodingException for Encoding Identity-H.
Do I have to install Arial Font or jasperreports-fonts-3.5.6.jar somewhere inside OpenKM server?Where?

Re: UnsupportedEncodingException in Jasper Reports

PostPosted:Mon Sep 17, 2012 2:25 pm
by jllort
This tag in unknown by me. If you do not add in your jasper report which error message do you get in server. Normally simply installing in your server MS core fonts. In ubuntu is something like apt-get install msttcorefonts ( I never need to use this tag for it ).

Re: UnsupportedEncodingException in Jasper Reports

PostPosted:Mon Sep 17, 2012 2:53 pm
by noxious
Jllort you misunderstood me. The tag I embedded is written inside my jrxml file. I use it to specify the font style of my text.
So every time I want to print a UTF-8 text inside my report I just specify that the text font will be Arial Unicode MS and the pdfEncoding will be Identity-H.
Code: Select all
<staticText>
<reportElement x="225" y="0" width="297" height="44"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial Unicode MS" size="22" isBold="true" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA["Here goes my UTF-8 text"]]></text>
</staticText>
This works when I execute the jrxml report using iReport, because I imported Arial font inside iReport. However, when I execute the jrxml file using OpenKM I get UnsupportedEncodingException. Apparently, I have to intsall Arial font somewhere inside jboss server folders, but I don't know where.I'm using windows 7 and the issue is only for pdf format.

Re: UnsupportedEncodingException in Jasper Reports

PostPosted:Mon Sep 17, 2012 4:54 pm
by noxious
I solved it finally using other font style in my jrxml file:
Code: Select all
			
<staticText>
<reportElement x="225" y="0" width="297" height="44"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="22" isBold="true" />
</textElement>
<text><![CDATA[Αρχείο Σημάτων 114 ΠΜ]]></text>
</staticText>
DejaVu Sans works perfect with UTF-8 chars and no problem at pdf reports either :D.

Re: UnsupportedEncodingException in Jasper Reports

PostPosted:Tue Sep 18, 2012 6:42 pm
by jllort
You can install as I told ms core fonts in server or simply add font to java ( google search for add java font in java virtual machine under your os , really is not jboss where should be placed the font or you install on server or install under JVM ). Hope this could be useful to you in future.