aspose word转pdf,linux预览乱码问题

发布时间:2022-06-27 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了aspose word转pdf,linux预览乱码问题脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

解决方法

1.将window中字体放到linux中,上传至/usr/shared/fonts/chinese目录下,接下里用

https://blog.csdn.net/GZSGZSgg/article/details/95641217?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_ecpm_v1~rank_v31_ecpm-1-95641217.pc_agg_new_rank&utm_term=aspose%E4%B9%B1%E7%A0%81+linux&spm=1000.2123.3001.4430

https://blog.csdn.net/chi_666/article/details/114606893?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_ecpm_v1~rank_v31_ecpm-3-114606893.pc_agg_new_rank&utm_term=aspose%E4%B9%B1%E7%A0%81&spm=1000.2123.3001.4430

2.在aspose代码中添加

@SneakyThrowspublic static void wordToPdf(String wordPath, String pdfPath) {    getLicense();    File file = new File(pdfPath);    try (FileOutputStream os = new FileOutputStream(file)) {        OsInfo osInfo = SystemUtil.getOsInfo();        if(osInfo.isLinux()){            FontSettings.setFontsFolder("/usr/share/fonts/chinese", true);        }        Document doc = new Document(wordPath);        doc.save(os, SaveFormat.PDF);    }}3.重启服务

脚本宝典总结

以上是脚本宝典为你收集整理的aspose word转pdf,linux预览乱码问题全部内容,希望文章能够帮你解决aspose word转pdf,linux预览乱码问题所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: