简体   繁体   English

如何从Java Web服务器打印Microsoft Word文档?

[英]How to print a microsoft word document from Java web server?

是否有任何开源或商业API可用于从Java应用程序打印word文档?

I think you might be able to do it from the command line. 我想你可以从命令行做到这一点。 Look here: http://fvue.nl/wiki/ClassExec#Printing 请看这里: http//fvue.nl/wiki/ClassExec#Printing

You might also want to look at this How can I print Office documents from .NET in a uniform manner? 您可能还想看看这个如何以统一的方式从.NET打印Office文档?

yet another possibility is to use OpenOffice to print from the command line. 另一种可能性是使用OpenOffice从命令行进行打印。

"C:\Program Files\OpenOffice.org 2.3\program\soffice.exe" -pt "Lexmark T640 (MS)" "c:\word_documents\AAA_TEST_DMHM_53317_696198.doc"

In order to print a *.doc or *.docx file, you need an application that renders the document with max fidelity, and only Microsoft Word can do that. 要打印* .doc或* .docx文件,您需要一个能够以最高保真度呈现文档的应用程序,并且只有Microsoft Word才能执行此操作。 While there are APIs that let you open the document and extract content, it does not seem this is helpful to you. 虽然有些API允许您打开文档并提取内容,但似乎这对您没有帮助。

This leaves you with only one option - COM automation. 这使您只有一个选项 - COM自动化。 There are commercial products for this, there may be free ones too. 有商业产品,也可以免费。 Here is an example . 这是一个例子

A warning: Office automation on a Web server has traditionally been a cumbersome thing to do. 警告:Web服务器上的Office自动化传统上是一件很麻烦的事情。 It is resource-intensive and unstable. 这是资源密集型和不稳定的。 I would try to design around it (ie see if you can change the document format, or they way it is created, or the business process). 我会尝试围绕它进行设计(即查看您是否可以更改文档格式,或者是否可以更改文档格式或业务流程)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM