如何将MS doc转换为pdf [英] How to convert MS doc to pdf
问题描述
如何使用java api将doc转换为pdf。其中document包含各种格式,例如ms word中的表格。使用iText转换为pdf时。实际文件看起来与转换后的pdf不同。请提供任何api而不是安装转换的exe。必须是一个开源的
How to convert doc to pdf using java api. where document contains various formats such as tables in ms word. when converting to pdf using iText. where actual document looks different to converted pdf. please provide any api not an exe installed for converting . must be an open source
推荐答案
这是一项非常艰巨的任务,如果你想要完美的结果会更难(不可能不使用Word)因此,在纯Java中为你完成所有API并且开源的API数量为零我相信(更新:我错了,见下文)。
This is quite a hard task, ever harder if you want perfect results (impossible without using Word) as such the number of APIs that just do it all for you in pure Java and are open source is zero I believe (Update: I am wrong, see below).
您的基本选项如下:
- 使用JNI / C#Web服务/ etc脚本MS Office(仅限100%完美结果的选项)
- 使用可用的API脚本打开Office(90 +%完美)
- 使用Apache POI& iText(非常大的工作,永远不会是完美的)。
更新 - 2016-02-11
以下是关于此主题的博客文章的简要副本,其中概述了支持Java中的Word-to-PDF的现有产品。
Update - 2016-02-11 Here is a cut down copy of my blog post on this subject which outlines existing products that support Word-to-PDF in Java.
转换Microsoft Office(Word,Excel)文档使用Java格式的PDF
我知道的三种产品可以呈现Office文档:
Three products that I know of can render Office documents:
yeokm1 / docs-to-pdf-converter
不规则维护,纯Java,开源
将许多库联系起来进行转换。
yeokm1/docs-to-pdf-converter Irregularly maintained, Pure Java, Open Source Ties together a number of libraries to perform the conversion.
xdocreport
积极开发,纯Java,开源
这是合并的Java API XML文档使用MS Office(docx)或OpenOffice(odt)创建,LibreOffice(odt)使用Java模型生成报告,并在需要其他格式(PDF,XHTML ...)时进行转换。
xdocreport Actively developed, Pure Java, Open Source It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
Snowbound Imaging SDK
已结束Source,Pure Java
Snowbound似乎是一个100%的Java解决方案,成本超过2,500美元。它包含描述如何在评估下载中转换文档的示例。
Snowbound Imaging SDK Closed Source, Pure Java Snowbound appears to be a 100% Java solution and costs over $2,500. It contains samples describing how to convert documents in the evaluation download.
OpenOffice API
开源,非纯Java - 需要安装Open Office
OpenOffice是一个支持Java API的本机Office套件。这支持阅读Office文档和编写PDF文档。 SDK包含文档转换中的示例(examples / java / DocumentHandling / DocumentConverter.java)。要编写PDF,您需要传递writer_pdf_Export编写器而不是MS Word 97编写器。
或者您可以使用包装器API JODConverter 。
JDocToPdf - 死了2016-02-11
使用Apache POI读取Word文档,使用iText编写PDF。完全免费,100%Java但有一些限制。
这篇关于如何将MS doc转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!