1、准备jar包
因为aspose jar包是收费的,所以maven无法下载
jar包链接 提取码:abcd
2、jar包添加到项目中
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>19.5</version>
</dependency>
3、项目使用
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
@Test
public void test4() {
String wordPath = "D:\\模型\\JUNSHIXUNL-canxun情况综合评估模型.docx";
String pdfPath = "D:\\模型\\JUNSHIXUNL-canxun情况综合评估模型.pdf";
try {
//新建一个pdf文档
File file = new File(pdfPath);
FileOutputStream os = new FileOutputStream(file);
//Address是将要被转化的word文档
Document doc = new Document(wordPath);
//全面支持DOC, DOCX, OOXM