POM引入Jar(本人把jar放在项目的src/main/resources/lib目录下):
<dependencies> <dependency> <groupId>e-iceblue</groupId> <artifactId>spire.doc</artifactId> <version>2.2.0</version> <scope>system</scope> <systemPath>${project.basedir}/src/main/resources/lib/spire.doc-2.2.0.jar</systemPath> </dependency> </dependencies>
World转PDF实现代码:
import com.spire.doc.Document; import com.spire.doc.FileFormat; public class ToPDF { public static void main(String[] args) { //加载word示例文档 Document document = new Document(); document.loadFromFile("D:\\test.docx"); //保存结果文档 document.saveToFile("toPDF.pdf",FileFormat.PDF); } }
原文地址:https://www.cnblogs.com/zxg-6/p/12683338.html
时间: 2024-10-07 22:38:54