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));
相关推荐
一头生产的驴6 小时前
java整合itext pdf实现自定义PDF文件格式导出
java·spring boot·pdf·itextpdf
开开心心就好1 天前
批量PDF转换工具,一键转换Word Excel
开发语言·前端·学习·pdf·电脑·word·excel
老家的回忆2 天前
jsPDF和html2canvas生成pdf,组件用的elementplus,亲测30多页,20s实现
前端·vue.js·pdf·html2canvas·jspdf
Vertira2 天前
pdf 合并 python实现(已解决)
前端·python·pdf
十一0829932 天前
【PDF-XSS攻击】springboot项目-上传文件-解决PDF文件XSS攻击
spring boot·pdf·xss
qq_393828222 天前
PDF的图片文字识别工具
windows·pdf·电脑·软件需求·图片处理
wsxqaz2 天前
浏览器原生控件上传PDF导致hash值不同
算法·pdf·哈希算法
工业3D_大熊12 天前
3D模式格式转换工具HOOPS Exchange如何将3D PDF转换为STEP格式?
3d·pdf·3d格式转换·3d模型格式转换·cad格式转换·cad数据格式转换·3d模型可视化
IDRSolutions_CN12 天前
在 Java 中生成 PDF 缩略图(教程)
java·经验分享·pdf·软件工程·团队开发
IDRSolutions_CN12 天前
用Java将PDF转换成GIF
java·经验分享·pdf·软件工程·团队开发