Venkat Sadasivam
Venkat Sadasivam

Reputation: 1464

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

Are there any open source or commercial API available to print word document from Java application?

Upvotes: 3

Views: 2124

Answers (2)

Romain Hippeau
Romain Hippeau

Reputation: 24375

I think you might be able to do it from the command line. Look here: 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?

yet another possibility is to use OpenOffice to print from the command line.

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

Upvotes: 1

cdonner
cdonner

Reputation: 37668

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. While there are APIs that let you open the document and extract content, it does not seem this is helpful to you.

This leaves you with only one option - COM automation. 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. It is resource-intensive and unstable. I would try to design around it (i.e. see if you can change the document format, or they way it is created, or the business process).

Upvotes: 1

Related Questions