How to configure iText to support Asian characters?

前端 未结 1 934
眼角桃花
眼角桃花 2021-01-12 10:47

My Java application creates PDFs using iText. Sometimes the content is Asian, which does not work. The Asian characters are not visible.

I found iTextAsian.jar

相关标签:
1条回答
  • 2021-01-12 11:04
    • You can define a "FontSelector" and then add your fonts (fontSelector.AddFont). Now iText will choose the not available char from the next defined font by using the fontSelector.Process method.
    • Asian characters are usually Unicode so you have to set "BaseFont.IDENTITY_H" instead of Ansi ones (such as FontFactory.GetFont("tahoma", BaseFont.IDENTITY_H)).
    • If it's RTL, you need to wrap your text in elements which have run direction property and set it to rtl.
    0 讨论(0)
提交回复
热议问题