File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to print a word document in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to print a word document in java?" Watch "how to print a word document in java?" New topic
Author

how to print a word document in java?

Umesh Sharma
Greenhorn

Joined: Oct 30, 2008
Posts: 3
Hi All,

is it possible in java to write a program that takes an input and sends it printer. I want this specially for word documents.
i already have a program that works for images but not for word documents.
Please guide me, where i am wrong or help me to get some links or code snippets regarding this. Any kind of help will be greatly appreciated.
I have done lot of RnD on this. Like HWPF and OpenOffice.org. But anything simpler is possible or not, i am surprised to find that such a simple thing is so tough in java. Please help.

//program that works for images but not for document is given below



[Nitesh: Added code tags, please UseCodeTags while posting code.]
[ November 01, 2008: Message edited by: Nitesh Kant ]
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

Howdy "wicked_yudi112233"!

Welcome to javaranch!
We being a very friendly community, do not have much rules but there is a naming policy that we are very strict about!
Unfortunately, your display name does not follow the policy. Please take a moment to change the same.

Also, this does not seem to be an advanced question, moving it to Java In General (Intermediate). You may get better answers there.


apigee, a better way to API!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
What is "an input" - an arbitrary file? .doc in particular is not a file format that is generally understood by printers. You will need a piece of software that understands .doc files and can render (and thus print) them.

Apache POI might help a bit if you use it to render a document into a Printable, but that will not work for complex documents, and would be quite a bit of programming effort on your part.

You might look into using OpenOffice as a server component for handling MS Office files. It does have a Java API.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to print a word document in java?
 
Similar Threads
Java Printing PDF in Background
Issue when doing Text Printing from Java to Canon iR1018 & iR1020
JAVA Printing Help
How can I send text characters to a printer device ?
Printing to Wireless printer.