使用Aspose.Words将word转换为pdf时,在windows系统使用时正常的,但在linux系统中出现docx可以正常转换,doc转换失败(Unknown file format)。
public static void wordToPdf(String wordPath,String pdfPath) {
FileOutputStream os = null;
try {
getLicense();
File file = new File(pdfPath);
os = new FileOutputStream(file);
Document doc = new Document(wordPath);
doc.save(os, SaveFormat.PDF);
os.close();
} catch (Exception e) {
logger.error("word转pdf失败!");
}
}

Aspose.Words 转换word文档为PDF时异常
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- 李堇 2022-04-19 18:32关注
原因已找到,因为使用的电脑都带有加密功能,导致未加密的文件另存为doc格式文件时自动加密,从而导致外网测试失败
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报