I am having hard time trying to generate PDF files containing Greek letters using itextpdf. I am reading the strings from an external source as UTF-8 strings. English letter
I used this code:
BaseFont fonty = BaseFont.createFont("assets/ARIALBD.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
fonty.setSubset(true);
Phrase myName = new Phrase("Your Not Latin Words", new Font(fonty,12));
ColumnText.showTextAligned(canvas,
Element.ALIGN_LEFT, myName, 66, 400, 0);
i had to paste the ARIALBD.TTF to assets folder
You need to use a font that has Greek characters in it. You may find Greek unicode fonts here.
You can check an example here on using unicode fonts from the author of itext.
Actually the problem could lead to the way you create the font. Instead of passing "UTF-8" as codepage try to use "CP1253".
BaseFont bfTimes = BaseFont.createFont(FontFactory.HELVETICA,"CP1253", BaseFont.EMBEDDED);
Font times = new Font(bfTimes, 12, Font.BOLD);
Btw, BaseFont has static string constnts for CP1250, CP1252 and CP1257...