自学内容网 自学内容网

PDF无法导出中文

font/SIMSUN.TTC' with 'Identity-H' is not recognized.

查看BaseFont源码发现".ttc,"

改为"SIMSUN.TTC,a"提示数字转换异常

改为"SIMSUN.TTC,11"提示数字索引必须介于0和1之间

改为0或1结果正常

BaseFont baseFont = BaseFont.createFont("/Users/fanshaorong/Desktop/uploadPath/templates/font/SIMSUN.TTC,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);

或者改为使用simfang.ttf

BaseFont baseFont = BaseFont.createFont(BASENAME, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            Font font = new Font(baseFont);

……
cell = new PdfPCell(new Paragraph(getFieldName(i), font));


原文地址:https://blog.csdn.net/steve_frank/article/details/142754670

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!