创建 Word (.doc) 文件,将其转换为 PDF 和 HTML,无需打开 Open Office 端口
我有一个项目需要创建一个具有特定格式的 Word (.doc) 文件以及从我的数据库中获取的特定数据。我想将该文件输出给他将编辑的用户,然后将文件上传回服务器。之后我想对上传的文件执行以下转换。
- .doc 到 .pdf(用于在网络上下载和查看)
- .doc 到 .html(用于网络上的自由文本搜索)
我想在不打开的情况下实现此目的开放办公室端口。早期版本就是这样做的,但是当用户较多时,打开的端口有崩溃的趋势。所以我想避免这样做。 Open Office和操作系统都在其他机器上重新安装,并以不同的方式进行了尝试,但每次用户增加时,OO端口都会崩溃。
还有其他方法可以实现这种转换吗?由于崩溃,无法继续此操作。
这是主机:
- Linux 上的 Tomcat 服务器(RedHat 64 位)
- 应用程序是用 Java 开发的(JSP 和 Servlet)
- 后端是 Oracle
所有用户都拥有:
- 一台 Linux 机器,主要是 32 位 Fedora 或 Suse
如有任何帮助,我们将不胜感激。
I have a project which requires creating a Word (.doc) file with certain formatting and certain data fetched from my database. I want to output that file to user which he would edit and the upload the file back it back to the server. After which I want to perform the following conversion on the uploaded file.
- .doc to .pdf (Intended to be downloaded and viewed on web)
- .doc to .html (Intended for free text search on web)
I want to achieve this without opening the Open Office port. The earlier version was doing this but the port opened had tendency of crashing when the users are more. So I want to avoid doing that. The Open Office and the OS both were re-installed on other machines and tried in different ways but the OO port crashed every time the users increased.
Is there any other way to achieve this conversion? Continuing with this is not possible due to the crashing.
This is the host machine:
- Tomcat server on Linux (RedHat 64 bit)
- The application is developed in Java (JSP and Servlets)
- The backend is Oracle
All users have:
- A Linux machine, mostly 32bit Fedora or Suse
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 http://poi.apache.org/ 来处理实际的 .doc 文件。对于 PDF,还有许多可用的 PDF 库。问题是很多都不是免费的,但这里有一个开源 PDF 库的列表: http://java-source.net/open-source/pdf-libraries
这里是关于Word 到HTML 的讨论。 在 Java 中以编程方式将 Word 文档转换为 HTML
You could use http://poi.apache.org/ for handling the actual .doc files. For PDF, there are a number of PDF libraries available as well. The catch is that many are not free, but here is a list of open source PDF libraries: http://java-source.net/open-source/pdf-libraries
Here is a discussion on Word to HTML. Convert Word doc to HTML programmatically in Java