javment
javment

Reputation: 368

Java PDFBOX text encoding

I try to export some data from my Java application to a pdf file. I decided to use the pdfBox library,but I realized that I could not do the Greek characters displayed properly into the pdf file. Is there a way to set the encoding? to utf8, or iso-8859-7? I try something like PdFontEncoding or Encoding but I did not get anything.

Thank you for your time.

Upvotes: 2

Views: 12800

Answers (1)

gutch
gutch

Reputation: 7139

There are two things you would need to do:

  • set the encoding, and
  • provide a font with Greek characters

The inbuilt fonts that most PDF readers have (ie Adobe Reader, OS X Preview, etc) only have the latin1 encoding, which doesn't include Greek characters. See http://libharu.sourceforge.net/fonts.html

My guess is that problem here is not with the encoding, instead the problem is the font. You will need to obtain a font with Greek characters and embed it in the PDF file. Make sure you have a licence to embed the font!

See also Using Java PDFBox library to write Russian PDF

Upvotes: 1

Related Questions