You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dola Woolfe <do...@yahoo.com> on 2010/06/29 21:08:03 UTC

PDF to acrobat

Hi,

I set

response.setContentType("application/pdf");


as a result, the served up content triggers a "Download" rather than opening acrobat within browser window.


Do I get to control what happens at client end? I want acrobat to open within browser.

How do I achieve that?

Thanks,

Dola


      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: PDF to acrobat

Posted by Dola Woolfe <do...@yahoo.com>.
There we go. Thank you!


----- Original Message ----
From: David Fisher <df...@jmlafferty.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Tue, June 29, 2010 3:41:18 PM
Subject: Re: PDF to acrobat

You will want to do this:

           response.setContentType("application/pdf");
           response.setHeader("Content-disposition", "inline");

For an attachment / download you will want to do:

           response.setContentType("application/pdf");
           response.setHeader("Content-disposition", "attachment;filename=downloaded.pdf");

Of course browser settings and how your Adobe Reader, Preview or Browser plugins are configured may override the "inline"?

What browsers and OS's matter to you? Older IE versions are pretty sticky. Firefox can be set to download no matter what.

Regards,
Dave

On Jun 29, 2010, at 12:08 PM, Dola Woolfe wrote:

> Hi,
> 
> I set
> 
> response.setContentType("application/pdf");
> 
> 
> as a result, the served up content triggers a "Download" rather than opening acrobat within browser window.
> 
> 
> Do I get to control what happens at client end? I want acrobat to open within browser.
> 
> How do I achieve that?
> 
> Thanks,
> 
> Dola
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: PDF to acrobat

Posted by David Fisher <df...@jmlafferty.com>.
You will want to do this:

           response.setContentType("application/pdf");
           response.setHeader("Content-disposition", "inline");

For an attachment / download you will want to do:

           response.setContentType("application/pdf");
           response.setHeader("Content-disposition", "attachment;filename=downloaded.pdf");

Of course browser settings and how your Adobe Reader, Preview or Browser plugins are configured may override the "inline"?

What browsers and OS's matter to you? Older IE versions are pretty sticky. Firefox can be set to download no matter what.

Regards,
Dave

On Jun 29, 2010, at 12:08 PM, Dola Woolfe wrote:

> Hi,
> 
> I set
> 
> response.setContentType("application/pdf");
> 
> 
> as a result, the served up content triggers a "Download" rather than opening acrobat within browser window.
> 
> 
> Do I get to control what happens at client end? I want acrobat to open within browser.
> 
> How do I achieve that?
> 
> Thanks,
> 
> Dola
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: PDF to acrobat

Posted by Hassan Schroeder <ha...@gmail.com>.
On Tue, Jun 29, 2010 at 12:16 PM, Dola Woolfe <do...@yahoo.com> wrote:

> For example, when I click on PDF links, sometimes it opens the file in the browser window and at other times it downloads the file.
>
> What's the possible difference in the (common default) settings?

Content-Disposition: <http://www.ietf.org/rfc/rfc2183.txt>

for one  :-)

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: PDF to acrobat

Posted by Dola Woolfe <do...@yahoo.com>.
Then I guess I am asking about most common default settings.

For example, when I click on PDF links, sometimes it opens the file in the browser window and at other times it downloads the file.

What's the possible difference in the (common default) settings?

Thanks,

Dola


----- Original Message ----
From: Thad Humphries <th...@gmail.com>
To: Tomcat Users List <us...@tomcat.apache.org>
Sent: Tue, June 29, 2010 3:14:03 PM
Subject: Re: PDF to acrobat

What happens on the browser end is entirely up to the user.  It's subject to
the browser they are using, whatever browser plug-ins they've installed, and
how they've set those plug-ins.

On Tue, Jun 29, 2010 at 3:08 PM, Dola Woolfe <do...@yahoo.com> wrote:

> Hi,
>
> I set
>
> response.setContentType("application/pdf");
>
>
> as a result, the served up content triggers a "Download" rather than
> opening acrobat within browser window.
>
>
> Do I get to control what happens at client end? I want acrobat to open
> within browser.
>
> How do I achieve that?
>
> Thanks,
>
> Dola
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)



      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: PDF to acrobat

Posted by Thad Humphries <th...@gmail.com>.
What happens on the browser end is entirely up to the user.  It's subject to
the browser they are using, whatever browser plug-ins they've installed, and
how they've set those plug-ins.

On Tue, Jun 29, 2010 at 3:08 PM, Dola Woolfe <do...@yahoo.com> wrote:

> Hi,
>
> I set
>
> response.setContentType("application/pdf");
>
>
> as a result, the served up content triggers a "Download" rather than
> opening acrobat within browser window.
>
>
> Do I get to control what happens at client end? I want acrobat to open
> within browser.
>
> How do I achieve that?
>
> Thanks,
>
> Dola
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)

Re: PDF to acrobat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thad,

On 6/29/2010 4:05 PM, Thad Humphries wrote:
> "application/octet-stream" is one way, but it's by no means bullet-proof.
> If the file name has an extension, some version of IE will blow off the MIME
> type and do what they damn well please based on the extension.

s/some version/all versions/

MSIE is not a compliant HTTP user agent by the W3C definition, and this
is one of the ways in which it breaks.

Hassan had the answer: it's the Content-Disposition header. Even MSIE
follows the rules on that one, and you can force a download.

> A while back I did some digging around and found that for all browsers I
> should call response.addHeader("Content-Disposition", "attachment;
> filename="myfile.pdf").  Then for IE I call
> response.setContentType("application/force-download; name="myfile.pdf")
> while for Firefox and Safari I use
> response.setContentType("application/octet-stream; name="myfile.pdf") works
> best.

That made-up Content-Type doesn't do anything at all for you, and it's
horribly broken. The Content-Type should not contain the "name" of the
file -- it's all in the Content-Disposition header.

The OP wants to /not/ download the file: the best advice is, as Zachary
suggested earlier, to simply correctly set the Content-Type to
application/pdf and take no further action. If there's a plug-in, it'll
probably run and display the file. Otherwise, the browser will likely
ask you to download the file or run it with a viewer you choose at the time.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwqqQAACgkQ9CaO5/Lv0PDrxwCgii7AOxCHKfY+lCPZcPTvJTNE
zPsAn2rRbNNecEqdABvTsmvfMhBNkksQ
=TAfx
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: PDF to acrobat

Posted by Thad Humphries <th...@gmail.com>.
Comment inline below.

On Tue, Jun 29, 2010 at 3:23 PM, Zachary Valentiner
<zv...@gmail.com>wrote:

> Hi Dola,
>
> Setting the content type to "application/octet-stream" will force a
> download. If I recall my headers correclty, setting "application/pdf" is as
> close as you can get to telling it to open in the browser without embedding
> it in an HTML file directly and thereby forcing the browser to use a plugin
> to render the PDF.
>

 "application/octet-stream" is one way, but it's by no means bullet-proof.
If the file name has an extension, some version of IE will blow off the MIME
type and do what they damn well please based on the extension.


> Someone might have some other tip, but this is also somewhat browser/plugin
> dependent, e.g., I notice different behavior between Firefox and Chrome,
> even when opening the same links to the same PDFs.
>
> Good luck,
>
> Zach
>

A while back I did some digging around and found that for all browsers I
should call response.addHeader("Content-Disposition", "attachment;
filename="myfile.pdf").  Then for IE I call
response.setContentType("application/force-download; name="myfile.pdf")
while for Firefox and Safari I use
response.setContentType("application/octet-stream; name="myfile.pdf") works
best.

-- 
"Hell hath no limits, nor is circumscrib'd In one self-place; but where we
are is hell, And where hell is, there must we ever be" --Christopher
Marlowe, 'Doctor Faustus' (v, 121-24)

RE: PDF to acrobat

Posted by Martin Gainty <mg...@hotmail.com>.
you'll want to acquire and configure the acrobat plugin for your browser

Firefox: 
http://kb2.adobe.com/cps/333/333563.html

 

Internet Explorer

http://kb2.adobe.com/cps/331/331025.html


Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> From: zvalentiner@gmail.com
> Subject: Re: PDF to acrobat
> Date: Tue, 29 Jun 2010 21:23:42 +0200
> To: users@tomcat.apache.org
> 
> Hi Dola,
> 
> Setting the content type to "application/octet-stream" will force a download. If I recall my headers correclty, setting "application/pdf" is as close as you can get to telling it to open in the browser without embedding it in an HTML file directly and thereby forcing the browser to use a plugin to render the PDF. 
> 
> Someone might have some other tip, but this is also somewhat browser/plugin dependent, e.g., I notice different behavior between Firefox and Chrome, even when opening the same links to the same PDFs.
> 
> Good luck,
> 
> Zach
> 
> 
> On Jun 29, 2010, at 9:08 PM, Dola Woolfe wrote:
> 
> > Hi,
> > 
> > I set
> > 
> > response.setContentType("application/pdf");
> > 
> > 
> > as a result, the served up content triggers a "Download" rather than opening acrobat within browser window.
> > 
> > 
> > Do I get to control what happens at client end? I want acrobat to open within browser.
> > 
> > How do I achieve that?
> > 
> > Thanks,
> > 
> > Dola
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> > 
> 
 		 	   		  
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

Re: PDF to acrobat

Posted by Zachary Valentiner <zv...@gmail.com>.
Hi Dola,

Setting the content type to "application/octet-stream" will force a download. If I recall my headers correclty, setting "application/pdf" is as close as you can get to telling it to open in the browser without embedding it in an HTML file directly and thereby forcing the browser to use a plugin to render the PDF. 

Someone might have some other tip, but this is also somewhat browser/plugin dependent, e.g., I notice different behavior between Firefox and Chrome, even when opening the same links to the same PDFs.

Good luck,

Zach


On Jun 29, 2010, at 9:08 PM, Dola Woolfe wrote:

> Hi,
> 
> I set
> 
> response.setContentType("application/pdf");
> 
> 
> as a result, the served up content triggers a "Download" rather than opening acrobat within browser window.
> 
> 
> Do I get to control what happens at client end? I want acrobat to open within browser.
> 
> How do I achieve that?
> 
> Thanks,
> 
> Dola
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>