Home
Saturday, April 29, 2017
4:05:42 AM
Users online: 0   You are here >> Home > Web Design

Forums | Web Design Forums search
Forum FAQ
   
 Previous Page 1 | 2  
How to force download a pdf iinstead of view in browser.
Girvo 
10/6/08 11:47:03 PM
Immortal

Yeah. Which you then encapsulate in an easy to reuse object so you never have to write it again, and can be dropped into frameworks with ease :D

-----
Quote by s.o.u.p!
I pull out my 27" telescopic baton and wave it menacingly at possums sometimes because I'm lonely and lame.




Euphemism?
LagrangeApex 
12/6/08 12:20:19 AM
Champion

touche

-----
-=-=-=-=-

spielentwickler 
15/7/08 12:33:06 AM
Guru

Why not just change the MIME type?

Don't browsers trust the MIME type over the file extension anyway? Just use a MIME type the built in reader doesn't support and it should offer to save it instead.

-----
http://www.last.fm/user/spielentwickler/
<= knight of the 6fAOEC =>

moofactory 
15/7/08 11:10:33 PM
Titan

Quote by spielentwickler
Why not just change the MIME type?

Don't browsers trust the MIME type over the file extension anyway? Just use a MIME type the built in reader doesn't support and it should offer to save it instead.



Mime type? you mean change the file extension?
Im sorry this is foreign to me.. could you explain what you mean?

-----
http://www.spore.com/sporepedia#qry=usr-moofactory

ozacube 
16/7/08 1:25:29 PM
Guru

He means to say that the MIME type is just information sent in the header, rather than the actual file extension.

What spielentwickler is suggesting is that you change the MIME in the response sent by the server, using the Content-Type header.

IMO, that's not a very good idea however, since you can use the response header to tell the broser that the response is to be saved.

This is what I found on google ... searching for 'JSP force download':
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2183&lngWId=2

Note the part that sets the header information:
 
//set the header and also the Name by which user will be prompted to save
response.setHeader ("Content-Disposition", "attachment;
filename=\"LicenseAgreement.pdf\"");


Also, here is some information searching about Content-Disposition:
http://support.microsoft.com/kb/260519

-----
*ISAIAH 53*

spielentwickler 
17/7/08 5:14:32 AM
Guru

nice find ozacube, i didn't know you could do that

-----
http://www.last.fm/user/spielentwickler/
<= knight of the 6fAOEC =>

Mr Dump 
2/8/08 8:33:13 PM
Master

I think page this does what moofactory wants... it is just an errata page for one of my subjects' textbooks.
http://www.box.net/shared/9bhqzm39mz
i.e. causes the .pdf to be downloaded rather than opened in the browser.

Q: can you look at the source and then work out how it is done?
BTW, I like this forum, and have followed orcone's thread about how to make a page, so thanks contributors! w3schools is helpful!
dt
edit: formatting of next line
(& still struggling with helloworld stuff...)


Edited by Mr Dump: 2/8/2008 08:34:01 PM

-----

TheSecret 
6/8/08 7:45:01 AM
Master
If you have access to the webserver, the easiest method would be to configure it there.

-----
Part of the inhumanity of the computer is that, once it is competently programmed and working smoothly, it is completely honest.

 Previous Page 1 | 2  
Forums | Web Design