原docx为五页
111.docx (16.0 KB)
保存后的pdf为三页
111.pdf (19.2 KB)
new Document(new FileInputStream("./111.docx")).save(new FileOutputStream("./111.pdf"), SaveFormat.PDF);
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>23.6</version>
</dependency>