脚本宝典收集整理的这篇文章主要介绍了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,请注明来意。