在Java中使用Office文档创建PDF的好方法[重复]

时间:2022-05-23 21:09:59

This question is an exact duplicate of:

这个问题与以下内容完全相同:

I'm looking for a good way to convert Office (mostly Microsoft) documents to PDF in Java. I've been looking at using the OpenOffice SDK but from the samples I've looked at it looks like this requires having OpenOffice running in server mode to do the work.

我正在寻找一种将Office(主要是Microsoft)文档转换为Java的PDF的好方法。我一直在考虑使用OpenOffice SDK,但从我看过的样本看来,这需要让OpenOffice在服务器模式下运行才能完成工作。

Does anyone know of a good way to do this? Good meaning the less external requirements, the better. A 100% Java API would be best, but I don't expect that actually exists.

有谁知道这样做的好方法?好的意思是外部要求越少越好。 100%的Java API是最好的,但我不认为它确实存在。

7 个解决方案

#1


4  

  • For accessing Office documents there exists POI
  • 对于访问Office文档,存在POI

  • For creating PDF documents there exists iText
  • 对于创建PDF文档,存在iText

Both are free imho.

两者都是免费的imho。

#2


3  

FYI looks like http://www.artofsolving.com/opensource/jodconverter nicely encapsulates all the OpenOffice server communication. This is the solution I'm pursuing at the moment.

仅供参考,http://www.artofsolving.com/opensource/jodconverter可以很好地封装所有OpenOffice服务器通信。这是我目前正在追求的解决方案。

#3


1  

You could try using Cute PDF writer which is basically a free PDF printer driver, and will work with any printing APIs.

您可以尝试使用Cute PDF writer,它基本上是一个免费的PDF打印机驱动程序,可以使用任何打印API。

#4


1  

The problem with Jodconvertor is that the project ended in Sep 2006. So I am not even sure it will work and run on OpenOffice 3.x. If anyone can confirm this, that would be great.

Jodconvertor的问题是该项目于2006年9月结束。所以我甚至不确定它是否可以在OpenOffice 3.x上运行。如果有人能证实这一点,那就太好了。

#5


1  

An alternative to POI is Scriptom which is based on Groovy and the Jacob Library. With it, you can access ActiveX or COM Windows components. I use it whenever I have to deal with Excel files.

POI的替代方案是Scriptom,它基于Groovy和Jacob库。有了它,您可以访问ActiveX或COM Windows组件。每当我必须处理Excel文件时,我都会使用它。

If you don't like Groovy, then you can build a very thin layer around the Scriptom API and use it from Java.

如果您不喜欢Groovy,那么您可以围绕Scriptom API构建一个非常薄的层并从Java中使用它。

#6


0  

Have a look at the Muhimbi PDF Converter Web Services. It runs on Windows as a service, but can be accessed from any non-Windows web services capable environment including Java and .NET

看看Muhimbi PDF Converter Web Services。它作为服务在Windows上运行,但可以从任何非Windows Web服务环境(包括Java和.NET)访问

Disclaimer, I worked on this product. Having said that, it works great.

免责声明,我参与了这个产品。话虽如此,它的效果很好。

#7


0  

Docmosis uses OpenOffice under the hood to assist in document production like JOD Reports and JODConverter. Docmosis allows you populate and manipulate the document via the Java API. It also provides built-in scalability, redundancy and load balancing and has a very low runtime overhead.

Docmosis使用OpenOffice来帮助文档生成,如JOD Reports和JODConverter。 Docmosis允许您通过Java API填充和操作文档。它还提供内置的可伸缩性,冗余和负载平衡,并且具有非常低的运行时开销。

#1


4  

  • For accessing Office documents there exists POI
  • 对于访问Office文档,存在POI

  • For creating PDF documents there exists iText
  • 对于创建PDF文档,存在iText

Both are free imho.

两者都是免费的imho。

#2


3  

FYI looks like http://www.artofsolving.com/opensource/jodconverter nicely encapsulates all the OpenOffice server communication. This is the solution I'm pursuing at the moment.

仅供参考,http://www.artofsolving.com/opensource/jodconverter可以很好地封装所有OpenOffice服务器通信。这是我目前正在追求的解决方案。

#3


1  

You could try using Cute PDF writer which is basically a free PDF printer driver, and will work with any printing APIs.

您可以尝试使用Cute PDF writer,它基本上是一个免费的PDF打印机驱动程序,可以使用任何打印API。

#4


1  

The problem with Jodconvertor is that the project ended in Sep 2006. So I am not even sure it will work and run on OpenOffice 3.x. If anyone can confirm this, that would be great.

Jodconvertor的问题是该项目于2006年9月结束。所以我甚至不确定它是否可以在OpenOffice 3.x上运行。如果有人能证实这一点,那就太好了。

#5


1  

An alternative to POI is Scriptom which is based on Groovy and the Jacob Library. With it, you can access ActiveX or COM Windows components. I use it whenever I have to deal with Excel files.

POI的替代方案是Scriptom,它基于Groovy和Jacob库。有了它,您可以访问ActiveX或COM Windows组件。每当我必须处理Excel文件时,我都会使用它。

If you don't like Groovy, then you can build a very thin layer around the Scriptom API and use it from Java.

如果您不喜欢Groovy,那么您可以围绕Scriptom API构建一个非常薄的层并从Java中使用它。

#6


0  

Have a look at the Muhimbi PDF Converter Web Services. It runs on Windows as a service, but can be accessed from any non-Windows web services capable environment including Java and .NET

看看Muhimbi PDF Converter Web Services。它作为服务在Windows上运行,但可以从任何非Windows Web服务环境(包括Java和.NET)访问

Disclaimer, I worked on this product. Having said that, it works great.

免责声明,我参与了这个产品。话虽如此,它的效果很好。

#7


0  

Docmosis uses OpenOffice under the hood to assist in document production like JOD Reports and JODConverter. Docmosis allows you populate and manipulate the document via the Java API. It also provides built-in scalability, redundancy and load balancing and has a very low runtime overhead.

Docmosis使用OpenOffice来帮助文档生成,如JOD Reports和JODConverter。 Docmosis允许您通过Java API填充和操作文档。它还提供内置的可伸缩性,冗余和负载平衡,并且具有非常低的运行时开销。