Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Download of PDF from Link

Status
Not open for further replies.

saw15

Technical User
Jan 24, 2001
468
US
I have a link on my html page that points to a pdf file. When the link is clicked, it opens in the users browser (or a new window if specified), which I really don't want it to do (due to size).

I would like to force the user to download the pdf file and then he/she can view it.

Can this be done from an html page?

Thanks in advance.

 
Zip the file.

If size is the problem, whats the difference between waiting to download the PDF and viewing the PDF?

The viewing is only one more step that's carried on the client's PC, which should be very fast once the temporary file is downloaded.

From there they can still go and select File->Save.

I suggest you zip the file and have two links, one for instant preview ( whoever has a broadband connection) and one for download (the zip file). Let them decide which one they want to click on.





grtfercho çB^]\..
"Imagination is more important than Knowledge" A. Einstein
-----------------------------------------------
 
Hi mate,

If you can use any server-side languages, then this is easy to do.

Just look up the content-disposition header in your preferred language.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top