Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem with Farsi fields in PDFs generated by JASPER

  Asked By: Oscar    Date: Mar 07    Category: Java    Views: 993

I am using jsprx files(designed in i-report) to generate pdf
reports out of an oracle database.

The Farsi fields are shown correctly when I output the report into
an HTML or when I view it with JasperView.

If I try making PDF files
(JasperExportManager.exportReportToPdfFile) the static fields
containing Farsi characters won't be displayed and dynamic fields
from the database with Farsi contents will be shown as ??? or null.

I reviewed some similar posts in the forum and found some
suggestions about using PARAMETERS to feed the report instead of
FIELDS, which I think can not be helpful in this case and in general.

I think this should be a common problem. These are the components I
am using:



4 Answers Found

Answer #1    Answered By: Daniel Jones     Answered On: Mar 07

it is simple, only
you must set the font and encoding and embedded propertes of your field and also copying the font that you use in the class path of your program.

Answer #2    Answered By: Mercedes Andrews     Answered On: Mar 07

copy this lines into jrxml file:

<reportFont name="titr" isDefault="false" fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="./fonts/tahomabd.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
<reportFont name="matn" isDefault="false" fontName="Serif" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="./fonts/times.ttf" pdfEncoding="Identity-H" isPdfEmbedded="true"/>

then copy tahomabd.ttf and times.ttf (for example) into fonts directory in your project.

Answer #3    Answered By: Fuzairah Neeman     Answered On: Mar 07

I noticed that the
key point is Identity-H(Unicode with Horizontal Writing) which
didn't function with CP1256. The hint was very useful.

Answer #4    Answered By: Brandi Ramirez     Answered On: Mar 07

Though my problem  with Farsi characters  is solved I still can't
display Farsi digits and dates.
I welcome any solution to this problem...

Didn't find what you were looking for? Find more on Problem with Farsi fields in PDFs generated by JASPER Or get search suggestion and latest updates.