itext生成pdf加了iTextAsian.jar还是报“Font 'STSong-Light' with 'UniGB-UCS2-H' is not re“
我下载了最新版的itext,版本是5.3.4,也下载了iTextAsian.jar,由于5.0后的itextjar包的包名字改了,然后,我重新修改iTextAsian.jar的包路径,由com.lowagie.text.pdf.fonts 更新为com.itextpdf.text.pdf.fonts,,然后按照网上的方法,把它加到classpath里面,,然后代码,
,还是报: Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized.的错误,是不是我的classpath有问题,还是其他的?
String filePath = "hello.pdf";
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(filePath));
document.open();
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED);
Font chineseFont= new Font(bfChinese, 12, Font.NORMAL);
PdfPCell cellReportSummary = new PdfPCell(new Phrase("支持中文",chineseFont));
document.add(cellReportSummary);
document.close();