Creating PDF using
Only kanji character 𠮷
is not displayed,
but all other Japanese characters are displayed on created PDF.
Used to set the BaseFont
BaseFont bfJapanese = BaseFont.createFont(
AsianFontMapper.JapaneseFont_Min,
AsianFontMapper.JapaneseEncoding_H,
BaseFont.NOT_EMBEDDED
);
Is there any other way to set the Japanese fonts?
You called the method BaseFont.createFont(String name, String encoding, boolean embedded)
correctly.
The AsianFontMapper
class has those constants for 2 font names and 4 encodings:
// font names
public static final String JapaneseFont_Go = "HeiseiKakuGo-W5";
public static final String JapaneseFont_Min = "HeiseiMin-W3";
// encodings
public static final String JapaneseEncoding_H = "UniJIS-UCS2-H";
public static final String JapaneseEncoding_V = "UniJIS-UCS2-V";
public static final String JapaneseEncoding_HW_H = "UniJIS-UCS2-HW-H";
public static final String JapaneseEncoding_HW_V = "UniJIS-UCS2-HW-V";
The Kanji character 𠮷
for "earth" should be supported by above Japanese fonts of Heisei family and all of those encodings.
Make sure that they are available the system creating and viewing the PDF.
When using embedded = false
to keep the PDF-size small, they must also been present on the viewing system.
See Wikipedia article: List of CJK fonts, especially the table for Japanese:
Heisei Mincho
font-family and Heisei Kaku Gothic
.SimHei
or SimSun
.Noto
family