aspose-words
收费价格
许可 | ||
---|---|---|
Developer Small Business - 1 Developer and 1 Deployment Location | 开发人员小型企业- 1个开发人员和1个部署位置 | 29,291 元 |
Developer OEM - 1 Developer and Unlimited Deployment Locations | 开发人员OEM - 1开发人员和无限部署地点 | 87,874 元 |
Site Small Business - Up to 10 Developers and up to 10 Deployment Locations | 站点小型企业-多达10个开发人员和多达10个部署地点 | 146,456元 |
Site OEM - Up to 10 Developers and Unlimited Deployment Locations | 站点OEM -多达10个开发人员和无限部署地点 | 410,077 元 |
技术支持服务 | ||
Developer Small Business 1 Year Developer Support License - up to 3 incidents per year | 开发人员小型企业1年开发人员支持许可证-每年最多3起事故 | 2,923 元 |
Aspose Business Support 商业服务 | ||
Developer Small Business 1 Year Business Support License - up to 6 incidents per year | 开发商小型企业1年业务支持许可证-每年最多6起事故 | 4,387 元 |
Developer OEM 1 Year Business Support License - up to 6 incidents per year | 开发人员OEM 1年业务支持许可证-每年最多发生6起事故 | 13,162 元 |
企业支持 | ||
Site Small Business 1 Year Enterprise Support License - up to 6 incidents per year | 网站小型企业1年企业支持许可证-每年最多6起事故 | 29,262 元 |
Site OEM 1 Year Enterprise Support License - up to 6 incidents per year | 站点OEM 1年企业支持许可证-每年最多发生6起事故 | 87,786 元 |
兼容性
poi
兼容性
OpenOffice
兼容性
spire.doc
兼容性
价格
docx4j
兼容性
各种组件的代码编写方法
aspose.words
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>22.11</version>
<classifier>jdk17</classifier>
</dependency>
package com.hawkon.aspose;
import com.aspose.words.*;
public class WordToPdfTest_Aspose {
public static void wordToPdf(String wordFile, String pdfFile) throws Exception {
Document wordDoc = new Document(wordFile);
PdfSaveOptions pso = new PdfSaveOptions();
wordDoc.save(pdfFile, pso);
}
}
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>19.5.0</version>
<scope>system</scope>
<systemPath>D:/Code/PdfTest/lib/aspose-words-19.5jdk.jar</systemPath>
</dependency>
docx4j
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-Internal</artifactId>
<version>8.2.4</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-export-fo</artifactId>
<version>8.2.4</version>
</dependency>
package com.hawkon.docx4j;
import org.docx4j.Docx4J;
import org.docx4j.fonts.IdentityPlusMapper;
import org.docx4j.fonts.Mapper;
import org.docx4j.fonts.PhysicalFonts;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileOutputStream;
public class WordToPdfTest_Docx4j {
public static void wordToPdf(String docFile,String pdfFile) throws Exception {
final Logger logger = LoggerFactory.getLogger(Docx4J.class);
WordprocessingMLPackage pkg = Docx4J.load(new File(docFile));
Mapper fontMapper = new IdentityPlusMapper();
fontMapper.put("隶书", PhysicalFonts.get("LiSu"));
fontMapper.put("宋体", PhysicalFonts.get("SimSun"));
fontMapper.put("微软雅黑", PhysicalFonts.get("Microsoft Yahei"));
fontMapper.put("黑体", PhysicalFonts.get("SimHei"));
fontMapper.put("楷体", PhysicalFonts.get("KaiTi"));
fontMapper.put("新宋体", PhysicalFonts.get("NSimSun"));
fontMapper.put("华文行楷", PhysicalFonts.get("STXingkai"));
fontMapper.put("华文仿宋", PhysicalFonts.get("STFangsong"));
fontMapper.put("仿宋", PhysicalFonts.get("FangSong"));
fontMapper.put("幼圆", PhysicalFonts.get("YouYuan"));
fontMapper.put("华文宋体", PhysicalFonts.get("STSong"));
fontMapper.put("华文中宋", PhysicalFonts.get("STZhongsong"));
fontMapper.put("等线", PhysicalFonts.get("SimSun"));
fontMapper.put("等线 Light", PhysicalFonts.get("SimSun"));
fontMapper.put("华文琥珀", PhysicalFonts.get("STHupo"));
fontMapper.put("华文隶书", PhysicalFonts.get("STLiti"));
fontMapper.put("华文新魏", PhysicalFonts.get("STXinwei"));
fontMapper.put("华文彩云", PhysicalFonts.get("STCaiyun"));
fontMapper.put("方正姚体", PhysicalFonts.get("FZYaoti"));
fontMapper.put("方正舒体", PhysicalFonts.get("FZShuTi"));
fontMapper.put("华文细黑", PhysicalFonts.get("STXihei"));
fontMapper.put("宋体扩展", PhysicalFonts.get("simsun-extB"));
fontMapper.put("仿宋_GB2312", PhysicalFonts.get("FangSong_GB2312"));
pkg.setFontMapper(fontMapper);
Docx4J.toPDF(pkg, new FileOutputStream(pdfFile));
}
}
OpenOffice
soffice.exe -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
<dependency>
<groupId>org.apache.directory.studio</groupId>
<artifactId>org.apache.commons.io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.artofsolving</groupId>
<artifactId>jodconverter</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>juh</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>unoil</artifactId>
<version>3.0.0</version>
</dependency>
package com.hawkon.openoffice;
import com.artofsolving.jodconverter.DocumentConverter;
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
import java.io.File;
import java.net.ConnectException;
public class WordToPdfTest_openoffice {
public static void wordToPdf(String docFile,String pdfFile) throws ConnectException {
// 源文件目录
File inputFile = new File(docFile);
// 输出文件目录
File outputFile = new File(pdfFile);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().exists();
}
// 连接openoffice服务
OpenOfficeConnection connection = new SocketOpenOfficeConnection(
"127.0.0.1", 8100);
connection.connect();
// 转换word到pdf
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
converter.convert(inputFile, outputFile);
// 关闭连接
connection.disconnect();
}
}
poi
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.core</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.itext.extension</artifactId>
<version>2.0.1</version>
</dependency>
package com.hawkon.poi;
import org.apache.poi.xwpf.converter.pdf.PdfConverter;
import org.apache.poi.xwpf.converter.pdf.PdfOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.io.*;
public class WordToPdf_Poi {
public static void wordToPdf(String docFile,String pdfFile) throws IOException {
XWPFDocument document;
InputStream doc = new FileInputStream(docFile);
document = new XWPFDocument(doc);
PdfOptions options = PdfOptions.create();
OutputStream out = new FileOutputStream(pdfFile);
PdfConverter.getInstance().convert(document, out, options);
doc.close();
out.close();
}
}
spire
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.doc</artifactId>
<version>10.11.6</version>
<scope>system</scope>
<systemPath>D:/Code/PdfTest/lib/Spire.Doc.jar</systemPath>
</dependency>
package com.hawkon.spire;
import com.spire.doc.*;
public class WordToPdf_spire {
public static void wordToPdf(String docFile,String pdfFile){
com.spire.license.LicenseProvider.setLicenseFile("D:\\Code\\PdfTest\\license.elic.xml");
//实例化Document类的对象
Document doc = new Document();
//加载Word
doc.loadFromFile(docFile);
//保存为PDF格式
doc.saveToFile(pdfFile,FileFormat.PDF);
}
}
测试结果
处理器 Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz 2.11 GHz
机带 RAM 16.0 GB (15.8 GB 可用)
系统类型 64 位操作系统, 基于 x64 的处理器
转换结果与原版对比
aspose.words对比图
docx4j
OpenOffice
poi
spire
评测结果
文章转载自姚Sir面试间,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。