Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

problem in creating a pdf in FARSI language with iText

  Asked By: Gene    Date: Sep 14    Category: Java    Views: 1584

I am trying to create a pdf in FARSI language with iText, but there is a
problem. I use different font but the problem is the sentence in pdf file
is separated, by thet I mean it will print the sentences in the pdf file
as separated letters.
I appreciate any comment on this.



4 Answers Found

Answer #1    Answered By: Canan Kaya     Answered On: Sep 14

BaseFont tahoma = BaseFont.createFont("times.ttf",
BaseFont.IDENTITY_H, true);
 font  font = new Font(tahoma, 10);

Answer #2    Answered By: Steve Boyd     Answered On: Sep 14

Thanks for your attention, but

didn,t work

Answer #3    Answered By: Raul Clark     Answered On: Sep 14

I think you get seperated letters  in words not sentences. Anyway, I guess you type your Persian text in a usual editor which gets your input all encoded between \u0600 and \u068f.

The characters mentioned above are uppercase characters which must be converted to apropriate lower case between the code \u0f70 and \ufeff to be shown correctly.

Editors like Microsoft Word save uppercases for farsi  but covert them using a complex script for showing them.

At last, take a look at the mentioned characters above in windows 'Character Map' then u can find out what happens.

Answer #4    Answered By: Farzaneh Vrm     Answered On: Jul 31

You should choose a suitable font like Nazanin. By this you get seprated farsi letters left to right.
Then you should change the writting direction from left to right to right to left.
use "PdfWriter.RUN_DIRECTION_RTL" in your settings.
PdfPCell and ColumnText have a property named runDirection that you should set it to PdfWriter.RUN_DIRECTION_RTL. In this way you can create a farsi pdf.

Didn't find what you were looking for? Find more on problem in creating a pdf in FARSI language with iText Or get search suggestion and latest updates.