Writing Arabic text to a PDF file

S

Swetha

Hello everyone

I have a Java application that writes to a PDF file using the gnujpdf
API. When I write English text to the PDF file it works fine.

The problem I encounter is when I try writing Arabic text to the file.
They end up as ???? (question marks). The Arabic strings to be written
to the pdf are present in Properties files in Unicode form.

When I display these Arabic strings on the screen using the Graphics
object, they appear perfectly fine. But the same Graphics object when
passed to the API's dispose method, ends up showing me only question
marks.

Does anyone have any ideas on how to work around this problem or solve
it? Has anyone tried writing Arabic text to PDF using gnujpdf before?

Thanks
Swetha
 
R

Richard Wheeldon

Swetha said:
The problem I encounter is when I try writing Arabic text to the file.
They end up as ???? (question marks). The Arabic strings to be written
to the pdf are present in Properties files in Unicode form.

Check which font the PDF is using. Not all fonts support Arabic
characters. Does it work with any other non-english characters?
Can you read any arabic PDFs?

If you don't have lots of text to write in different languages,
try taking a look here:
http://www.columbia.edu/kermit/utf8.html

Richard
 
S

Swetha

Richard,

I do have lots of text to be written in Arabic. And yes, I am able to
read other Arabic PDFs.

I think the problem is with writing Arabic in Unicode form to the PDF.

Do you have any idea how this can be solved?

Swetha
 
S

Swetha

Richard said:
Can you read any arabic PDFs?

I can read Arabic PDFs. I think the issue is with writing to the PDF.
Do I need to embed the fonts I need?

And well, I have quite a lot of Arabic and other language text to be
written to the PDF.

Swetha
 
R

Roedy Green

I can read Arabic PDFs. I think the issue is with writing to the PDF.
Do I need to embed the fonts I need?

The idea of PDF is if you don't embed fonts, then the reader will make
do with whatever fonts the client has. If you are sure he has
suitable fonts, you can leave them out.
 
S

Swetha

I'm using "Simplified Arabic" to generate the PDF and the font is
present on my system. However, I can still not read the generated PDF.

Later, I used Adobe Distiller to create a new default PDF setting that
embeds another Unicode Arabic font(Lateef) that I downloaded. I used
this font to create the PDF from my Java app. As before, the graphics
displayed on the screen shows up fine but when the same object is sent
to the PDF for writing, it ends up as question marks.
 
R

Richard Wheeldon

Swetha said:
Richard,

I do have lots of text to be written in Arabic. And yes, I am able to
read other Arabic PDFs.

I think the problem is with writing Arabic in Unicode form to the PDF.

Do you have any idea how this can be solved?

I'm not sure. Check that everything is using the same unicode
format where appropriate. e.g. All expecting utf8. Take a look
at some of the other PDF processors. e.g. FOP or iText. Even if
you don't intend using them, getting a simple example working
might point you in the right direction,

Richard
 
S

Swetha

Thanks Richard, I tried i-Text and it seems to work relatively more
predictably, so I've decided to go with i-Text.

Swetha
 
R

rwatki44

Swetha said:
Thanks Richard, I tried i-Text and it seems to work relatively more
predictably, so I've decided to go with i-Text.

Swetha

Swetha, I see that you have decided to go with iText. But, if you are
ever looking for a product with great Unicode character support, I work
for a company, ceTe Software, that has a DynamicPDF Merger/Generator
for Java product.

If you would like to see what our product can do feel free to download
our free evaluation version from our site,
http://www.cete.com/Products/MergerForJava/Download.csp.

Robbie
 
R

rwatki44

Swetha said:
Thanks Richard, I tried i-Text and it seems to work relatively more
predictably, so I've decided to go with i-Text.

Swetha

Swetha, I see that you have decided to go with iText. But, if you are
ever looking for a product with great Unicode character support, I work
for a company, ceTe Software, that has a DynamicPDF Merger/Generator
for Java product.

If you would like to see what our product can do feel free to download
our free evaluation version from our site,
http://www.cete.com/Products/MergerForJava/Download.csp.

Robbie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top