背景
最近在找word转pdf的方法,我是使用 poi制作的word
在网上发现两个依赖
<!-- 依赖一 -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.poi.xwpf.converter.pdf</artifactId>
<version>2.0.2</version>
</dependency>
<!-- 依赖二 -->
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
<version>1.0.6</version>
</dependency>
运行结果
//1.加载poi 的docx文档
XWPFDocument document = new XWPFDocument(new FileInputStream(file));
//2. 将docx 文档转换为pdf
File outFile = new File(targetPath);
OutputStream out = new FileOutputStream( outFile );
//PdfOptions options = null;
//PdfOptions options = PdfOptions.create().fontEncoding( "windows-1250" );
PdfConverter.getInstance().convert( document, out, null);
- 网上的示例是使用依赖二,我使用之后报错
- 在网上找到依赖二转换成功
我的问题
我在网络上找不到这两个依赖的介绍,所以我想知道
- 这两个依赖有什么作用和不同之处
- 或者如何能够找到他们的使用方法
提前感谢各位同学的帮助