首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Docx4j:已弃用转换为PDF

Docx4j:已弃用转换为PDF
EN

Stack Overflow用户
提问于 2013-12-30 20:57:18
回答 3查看 27.2K关注 0票数 8

docx4j的"getting started“文档包含将docx写入pdf的示例代码:

代码语言:javascript
运行
复制
// Set up converter
org.docx4j.convert.out.pdf.PdfConversion c = 
    new org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);

然而,从docx4j 3.0开始,整个PdfConversion工具似乎都被弃用了,而没有通知现在如何执行转换。那么,在docx4j 3.0中将docx转换为pdf的不被推荐的方式是什么呢?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-12-31 03:21:50

PDF3.0有一个外观,你可以用它来转换成docx4j。

下面是一个使用它的例子

https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java

票数 5
EN

Stack Overflow用户

发布于 2016-03-31 20:59:35

这就是你怎么做的:

代码语言:javascript
运行
复制
Docx4J.toPDF(wordMLPackage, new FileOutputStream("path/to/your-pdf-file.pdf"));
票数 13
EN

Stack Overflow用户

发布于 2016-11-22 01:01:50

说得够多了..。从示例源代码中:

代码语言:javascript
运行
复制
 * From v3.3.0, PDF output is by default via Plutext's commercial PDF Converter.
 * 
 * By default, the evaluation instance at:
 * 
 *      http://converter-eval.plutext.com:80/v1/00000000-0000-0000-0000-000000000000/convert
 *  
 * is used.  To specify your own instance, please set docx4j.properties property: 
 * 
 *      com.plutext.converter.URL=http://your.host:80/v1/00000000-0000-0000-0000-000000000000/convert
 * 
 * If you don't want to use Plutext's PDF Converter, you can still use XSL FO and Apache FOP;
 * just put docx4j-export-fo and its depedencies on your classpath and use Docx4J.toFO
 * as per the example below.

那么,如果必须退回到使用XSL-FOP/ Docx4J,那么使用XSL有什么意义呢?!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20840051

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档