Hi fellow members,

Yep! AFAIK, in a web application, this is the only
way it will work, _provided_ that the user uses IE
and has a local Word installation available. Then
you may load the Word document into the frame
and print it via the browser's 'Print' button. Note:
this only works because IE is implemented as
an OLE document server which automatically
starts Word as a background process if needed.
Furthermore, in a web app, there is no great
use for JNI on the client, as the VM runs on
the server, and that one may easily be some
thousand miles away ;) And as Word is only
available on the Microsoft platform, even this
won't work in any other configuration. Never
really tried the 'window.print()' approach, that
may work as well, but keep in mind that it
requires scripting, and users tend to disable
this feature for security reasons (same is
true for starting something in an IFRAME
and cross-frame access to an URL which
the browser _thinks_ is coming from two
different servers, btw). To make it short,
there is no clean oder 'decent' solution
to the problem. Still, you could convert
the Word document to HTML prior to
delivery on serverside, provided that the
user shall have no means of interactively
modifying it clientside. In this case, a
possible approach might be to retrieve
the document from the database, store
it as a local file on the server, write a
JNI Adapter (or use one of the existing
ones, use Google) which triggers a ser-
verside instance of Word (limiting your
app to the Windows Platform as well ;),
have Word store the result as an HTML
document and present that one to the
client. Better not even think about
scalability and thread issues; in any
case, there is no clean and easy way
out. Note: the actual problem ist just
that the Word document format is
proprietary and nothing a browser
understands by itself.

-- Chris (SCPJ2)

NB. There is an Apache project named
POI dealing with 'natively' accessing the
'Compound Document Format' via Java,
currently limited to Excel, but still
worth a look (www.apache.org).

----- Original Message -----
From: "Rodrigo Ruiz Aguayo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 10, 2002 12:35 PM
Subject: Re: printing a document on click of button


> You could try to download the file to a hidden frame (or iframe), and once
downloaded, print it.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to