Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to print a word document in java?

 
Umesh Sharma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic