<dependency> <groupId>com.itextpdf</groupId> <artifactId>itext-asian</artifactId> <version>5.2.0</version> </dependency>
?
BaseFont baseFont = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
String fontPath = "font/simsunb.ttf"; BaseFont baseFont1 = BaseFont.createFont(fontPath, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
?正确示例:
Font contentFont = new Font(baseFont, 36, Font.NORMAL);
contentFont.setColor(BaseColor.BLACK);
Paragraph content = new Paragraph("Hello world!!你好!This is ...搁这搁这呢", contentFont);
?Error show:
Font contentFont = new Font(baseFont, 36, Font.NORMAL);
contentFont.setColor(BaseColor.BLACK);
Paragraph content = new Paragraph("Hello world!!你好!This is ...搁这搁这呢", contentFont);