Printing MS Word from a JAVA application in a UNIX server

O

Oz

Hi,

I have the following issue:

I am migrating a java application in a Unix server that used to use a
commercial product to connect with a Windows server to print and
process ms word files (from a .doc template and an xml file containing
data the process birngs back a .prn file to print in a print server and
a .doc itself).
Now we are getting rid of the commercial product, what means that I'm
doing everything in the Unix server. The process is quite easy to code
because I just saved the templates as .xml documents (thanks to office
2003), but I'm stuck with the printing problem.
How can I print a word document (without loosing format) in a Unix
server from a java application? How can I get a printing document (as I
used to get a .prn)?

Thanks in advance.
 
J

James McGill

How can I print a word document (without loosing format) in a Unix
server from a java application?

http://jakarta.apache.org/poi/index.html

To do better, maybe you can get word format specs under NDA from
Microsoft. Good luck with that. I'm not being *too* cynical here.
I've worked for a company and for a university that each had a certain
amount of Microsoft source code, so who knows?

Maybe there's a Word Doc to PDF converter, at least that would give you
a known format.

Maybe there's a way to connect JNI to Winelib and use some Office DLL to
do the conversion. Or, connect to one of the commercial printer drivers
that converts Word to Postscript or PDF, and deal with the output. Or,
maybe you can connect an ActiveX control that can display a Word
document, and then screen scrape [I'm serious.]

But you are treading into territory where Microsoft has gone to great
lengths to prevent you from doing what you need to do. If your
documents are in Word97 doc format, and don't have too much (any) OLE or
weird formatting.
 
J

James McGill

If your
documents are in Word97 doc format, and don't have too much (any) OLE
or
weird formatting.

Sorry I didn't finish that last sentence.

Anyway, to paraphrase your question:

"I went to bed with the Devil, and now I'm looking for a way to remove
the pitchfork from my butt."
 
R

Roedy Green

How can I print a word document (without loosing format) in a Unix
server from a java application?

The easiest way might be to set up an old clunker under Windows, and
write a little program on it that wakes up every once in a while
looking for files in its queue, and it is use EXEC to feed them to
word itself for printing. Your server then only has to put the files
in a directory on disk. It can once a day clear files more a day old,
or allow the windows program to delete once successfully printed.
 
O

Oz

Hi Roedy,

The only problem I see is that I don't have Windows. I run the
application under UNIX, and I am not allowed to have Open Office on it,
so not an easy issue...
Do you know any alternative?

Thanks in advance.
 
O

Oz

Hi James,

Thanks for your post. Perhaps you have a concrete solution for the
problem, if you have being working in a similar project? I was hopping
I could find an API or create a simple-medium java process to print the
..doc in UNIX, because I don't think with the budget I received I'm
going to be able to do anymore...

Any help will be more than welcome.
 
R

Roedy Green

The only problem I see is that I don't have Windows. I run the
application under UNIX, and I am not allowed to have Open Office on it,
so not an easy issue...
Do you know any alternative?

Every business has a old klunker windows machines lying in a closet
somewhere. Just dig it out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,732
Latest member
ArronPalin

Latest Threads

Top