Itext Arabic Font coming as question marks

后端 未结 1 2027
野的像风
野的像风 2021-01-20 20:27

I am new to iText library. I have a requirement where i need to provide the output as PDF. The pdf has Arabic characters in it. I created a test servlet as given below.

相关标签:
1条回答
  • 2021-01-20 20:51

    Your problem is where you're creating the BaseFont with the Windows CP1252 Character Set, which is only suitable for latin characters. Try the encoding for Unicode instead:

     BaseFont bf  = BaseFont.createFont("C:\\WINDOWS\\Fonts\\ARIALUNI.ttf", BaseFont.IDENTITY_H, true);
    
    0 讨论(0)
提交回复
热议问题