Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Printing MS Word from a JAVA application in a UNIX server

Thread view: 
Oz - 18 Apr 2006 15:33 GMT
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.
James McGill - 18 Apr 2006 19:30 GMT
> 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.
James McGill - 18 Apr 2006 19:33 GMT
> 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."
Oz - 19 Apr 2006 10:01 GMT
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.
Roedy Green - 18 Apr 2006 21:48 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oz - 19 Apr 2006 09:56 GMT
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.

> >How can I print a word document (without loosing format) in a Unix
> >server from a java application?
[quoted text clipped - 9 lines]
> Canadian Mind Products, Roedy Green.
> http://mindprod.com Java custom programming, consulting and coaching.
Roedy Green - 20 Apr 2006 01:46 GMT
>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.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.