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 ]
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.
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.