Hello Bjørn T Johansen,

In order to achieve what you want, you've got two problems.

1) A printer is considered as a local devices, which isn't directly accessible 
from a loaded page in browser. A browser can request a page to be printed, but 
the security model of a browser enforces the required 'Print dialog'.
2) Your are not trying to print an HTML-page but a .pdf-file, which can't 
invoke the print-command onLoad.

For the first problem there are some (IE-only) solutions like ScriptX: 
http://www.meadroid.com/scriptx/index.asp, but the second will remain. By 
setting the correct response header you could get the pdf to open correctly in 
a browser, but the user will have to choose to print it themselves.

IMHO: It can't be done.

If you ever fid a way around these problems, please let me know!

With kind regards,
  Marco






-----Original Message-----
From: Bjørn T Johansen [mailto:[EMAIL PROTECTED] 
Sent: woensdag 17 januari 2007 10:37
To: [email protected]
Subject: Re: [ABOT] Sending pdf file from webserver to browser?

Yes, I am setting it to application/pdf... Why?

BTJ

On Wed, 17 Jan 2007 10:30:38 +0100
<[EMAIL PROTECTED]> wrote:

> Hi
> 
> Are you setting the content-type on the response?
> 
> Hermod
> 
> -----Original Message-----
> From: Thorbjørn Ravn Andersen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 17, 2007 10:13 AM
> To: MyFaces Discussion
> Subject: Re: [ABOT] Sending pdf file from webserver to browser?
> 
> 
> Bjørn T Johansen skrev  den 16-01-2007 14:42:
> > I have a myfaces webapp that uses a report component to generate a pdf file 
> > on the server. This file is
> > sent to the browser and the user then get a choice of saving the file or 
> > opening the file, eg. in Acrobat.
> >
> > And I was wondering, it is possible to skip the opening og saving dialog 
> > and go straight to printing the
> > pdf file? As far as I can tell, this isn't possible..
> I don't think so, unless you can print to the users printer from the server.
> 




------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
New Jersey, USA 08889), and/or its affiliates (which may be known
outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD
and in Japan, as Banyu - direct contact information for affiliates is 
available at http://www.merck.com/contact/contacts.html) that may be 
confidential, proprietary copyrighted and/or legally privileged. It is 
intended solely for the use of the individual or entity named on this 
message. If you are not the intended recipient, and have received this 
message in error, please notify us immediately by reply e-mail and then 
delete it from your system.

------------------------------------------------------------------------------

Reply via email to