itext PDF - Greek letters are not appearing in the resulting PDF document

前端 未结 3 780
春和景丽
春和景丽 2021-01-14 16:20

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

3条回答
  •  不思量自难忘°
    2021-01-14 17:08

    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...

提交回复
热议问题