How to configure iText to support Asian characters?

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

I found iTextAsian.jariText on the download page, but don't know how to use it.

The goal is to use my favorite default font. But when a character is unavailable, a different font is used for that character. I read, iText can automatically select fonts this way, but how to configure this?

I also want all the necessary fonts to be included in the PDF, so users do not need to install Asian fonts on their computers.

+5
source share
1 answer
  • You can define "FontSelector" and then add fonts (fontSelector.AddFont). Now iText will select the inaccessible char from the next specific font using the fontSelector.Process method.
  • Asian characters are usually Unicode, so you need to set "BaseFont.IDENTITY_H" instead of Ansi (for example, FontFactory.GetFont ("tahoma", BaseFont.IDENTITY_H)).
  • If this is RTL, you need to wrap the text in elements that have the direction direction property and set it to rtl.
+2
source

All Articles