Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Jasper Reports BIDI languages (+ Hebrew) Problem

Reply
Thread Tools

Jasper Reports BIDI languages (+ Hebrew) Problem

 
 
friedman30@gmail.com
Guest
Posts: n/a
 
      01-23-2007
Hi,
I'm trying to generate a report with Hebrew fonts in it.
When running it with iReport tool, everything works great, but when
running the report from a java code, I get an error message indicating
that the desired pdf font is not found....

I can't find the FontMap for Jasper therefore I can't even try to add
the desired font...

I know it is possible to use jasper reports with Hebrew, but for some
reason I still did not find a way to do it...

PLS. H E L P . . . .

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?hermann_krau=DF?=
Guest
Posts: n/a
 
      01-24-2007
Hi,
I'm also trying to work with Hebrew,
but I use Unicode-Fonts.

There I have the Problem, that the cantilation-marks(accents) are
often not at the right place.
This seems to be a problem with java.
With other programms the same fonts work good.

Hermann

wrote:
> Hi,
> I'm trying to generate a report with Hebrew fonts in it.
> When running it with iReport tool, everything works great, but when
> running the report from a java code, I get an error message indicating
> that the desired pdf font is not found....
>
> I can't find the FontMap for Jasper therefore I can't even try to add
> the desired font...
>
> I know it is possible to use jasper reports with Hebrew, but for some
> reason I still did not find a way to do it...
>
> PLS. H E L P . . . .
>

 
Reply With Quote
 
 
 
 
friedman30@gmail.com
Guest
Posts: n/a
 
      01-24-2007
Hi Herman,

could you please tell me how are you using Unicode-Fonts (did you have
to add fonts? if so - where to? etc.)
did you have to check the java jdk font's folder??

thanks,

Dror

 
Reply With Quote
 
=?ISO-8859-1?Q?hermann_krau=DF?=
Guest
Posts: n/a
 
      01-25-2007
wrote:
> Hi Herman,
>
> could you please tell me how are you using Unicode-Fonts (did you have
> to add fonts? if so - where to? etc.)

hi Dror,
I have added the fonts "Ezra SIL" and "Code2000" to my operating system
but you can also run most standard fonts with unicode.
the encoding-tables you find on internet.
you can specify unicode strings in your java code as follows:
String s = "This is a String containing unicode: \u<hhhh>\u002a..."
where <hhhh> is any Hex Nrumber from 0000 to ffff

enjoy!
> did you have to check the java jdk font's folder??
>
> thanks,
>
> Dror
>

 
Reply With Quote
 
friedman30@gmail.com
Guest
Posts: n/a
 
      01-26-2007
Hi Hermann,

Thanks for the effort!!

I need to ask some more things though...

Did this solution work with Jasper-Reports and Java?

I have the desired font installed in my computer (both in OS and in
iReport font library), but still, when I run the code, I get an error
message (from Jasper engine) about missing the font...

Any idea on how to solve this ???

Thanks again,

Dror

 
Reply With Quote
 
=?ISO-8859-1?Q?hermann_krau=DF?=
Guest
Posts: n/a
 
      01-29-2007
wrote:
> Hi Hermann,


Hi Dror,

> Did this solution work with Jasper-Reports and Java?

Java is no Problem
- Use 1.6 for better support of cantilation-marks
with jasper reports i cant help you

>
> I have the desired font installed in my computer (both in OS and in
> iReport font library), but still, when I run the code, I get an error
> message (from Jasper engine) about missing the font...
>
> Any idea on how to solve this ???

sorry,
but first try a standard font with unicode
- but they look not very good

hope i could help you a little,
hermann
 
Reply With Quote
 
=?ISO-8859-1?Q?hermann_krau=DF?=
Guest
Posts: n/a
 
      01-29-2007
Hi Dror,
hab da nochn kleines Rätsel für dich:

\u05db\u05bc\u05b7\u05e6\u05bc\u05b4\u05e4\u05bc\u 05a3\u05d5\u05b9\u05e8
\u05dc\u05b8\u05ad\u05e0\u05d5\u05bc\u05d3
\u05db\u05bc\u05b7\u05d3\u05bc\u05b0\u05e8\u05a3\u 05d5\u05b9\u05e8
\u05dc\u05b8\u05e2\u0591\u05d5\u05bc\u05e3
\u05db\u05bc\u05b5\u05a5\u05df
\u05e7\u05b4\u05bd\u05dc\u05b0\u05dc\u05b7\u05a5\u 05ea
\u05d7\u05b4\u059d\u05e0\u05bc\u05b8\u0597\u05dd \u05dc\u05d0
(\u05dc\u05a3\u05d5\u05b9) \u05ea\u05b8\u05d1\u05b9\u05bd\u05d0\u05c3

Hermann
 
Reply With Quote
 
friedman30@gmail.com
Guest
Posts: n/a
 
      01-29-2007
the solution:

First of all, I've updated the iText jar and src files to the latest
(1.4.
http://www.lowagie.com/iText/download.html
(the jar that came with the jasperReports download was older)

Then, I've added this code that adds the desired font at runtime:

HashMap fontMap = new HashMap();
FontKey key = new FontKey("Arial", false, false); //(String fontName,
Boolean bold, Boolean italic)
PdfFont font = new PdfFont("(fontPath)\
\ARIAL.TTF",BaseFont.IDENTITY_H,true); //(String pdfFontName, String
pdfEncoding, Boolean isPdfEmbedded)
fontMap.put(key,font);

JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRPdfExporterParameter.CHARA CTER_ENCODING,
"UTF-8");
exporter.setParameter(JRPdfExporterParameter.FONT_ MAP, fontMap);

Note that "Arial" parameter in FontKey method points to the iReport
"Font Name" field (although the font added is actually "ARIAL.TTF") -
so when designing the report, you have to choose "ARIAL.TTF" as "PDF
Font Name" and "Arial" as "Font Name"!!! this is very important cause
for some reason, at run time, Jasper engine searches for the TTF font
by the key of "Arial".

Then, all you have to do is to set the parameters and export the
report (or generate the report in any other way) I've done it this
way:

//@ pathOfJasperFile - the compiled jasper file
//@parameters - a map with report's parameters
//@ conn - a connection to the DB
JasperPrint jasperPrint =
JasperFillManager.fillReport(pathOfJasperFile, parameters, conn);
exporter.setParameter(JRPdfExporterParameter.JASPE R_PRINT,
jasperPrint);
//@pdfFileName - the file that jasper engine will create. (pdf file)
exporter.setParameter(JRPdfExporterParameter.OUTPU T_FILE_NAME,
pdfFileName);
exporter.exportReport();

notes: a. you'll have to add a specific font for Bold font Italic font
etc. (remember to set the FontName)
b. if, for example, you'll add a font and mark it as Bold - you have
to choose "Bold" at iReport (when designing the report) or else
jasper engine would not find the font that you've added, even if all
other parameters are right!

Hope this helps.

Dror Friedman

Finally


(THANKS for the help Hermann!!!)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Jasper Reports JScoobyCed Java 6 07-30-2010 05:42 AM
Please Help..How to Use Jasper Reports in JAVA javaTechie Java 3 07-30-2010 05:37 AM
Jasper Report vs. Crystal Reports stanberka Java 13 07-30-2010 05:34 AM
scrollLeft and bidi languages ChadW Javascript 2 08-09-2007 09:15 PM
Java and Jasper reports help sconeek@gmail.com Java 0 04-11-2006 10:53 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57