日期:2014-05-17 浏览次数:20745 次
,还是报: 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();