How to force a download of pdf?
-
435pJJau251
- Posts: 44
- Joined: 17 Jun 11
- Location: China
- Trust:
05 Aug 11 6:47 am
How to force a download of pdf?
Not sure if this is in the right section, as I don't know how to begin doing it!
I have several pdfs on my site which I sell using Paypal. I am currently emailing them out on payment, but it's not a very efficient system, so I'm going to use the redirect feature on Paypal to send the buyer to a page with a link to the pdf.
I then want to have a button or link for the buyer to click to download the pdf to their own computer, rather than have the pdf opening up in the browser.
I guess html won't do this? PHP? Javascript? Anybody got a simple script/link where I can copy and paste some simple code?
I have several pdfs on my site which I sell using Paypal. I am currently emailing them out on payment, but it's not a very efficient system, so I'm going to use the redirect feature on Paypal to send the buyer to a page with a link to the pdf.
I then want to have a button or link for the buyer to click to download the pdf to their own computer, rather than have the pdf opening up in the browser.
I guess html won't do this? PHP? Javascript? Anybody got a simple script/link where I can copy and paste some simple code?
-
essexboyracer
- Posts: 130
- Joined: 02 May 11
- Location: Great Britain
- Trust:
06 Aug 11 4:14 pm
I think a lot of this is down to browser preferences, how to handle mime types. I would give simple directions such as , "right mouse button and save target as". If you're really bothered try dynamicdrive.com or http://www.google.com/search?q=jquery+f ... f+download
-
jmpruitt - Posts: 4507
- Joined: 19 Jun 09
- Location: United States
- Trust:
06 Aug 11 5:51 pm
I always save mine into a compressed zip file. then they just download the zip file and extract the pdf doccument.
James Pruitt,
Get my exact strategy for forum marketing and brand your business today...
http://www.forumsweeper.com
Get my exact strategy for forum marketing and brand your business today...
http://www.forumsweeper.com
-
thel.online.ph
- Posts: 109
- Joined: 13 Sep 11
- Location: Philippines
- Trust:
23 Sep 11 1:42 am
Hi,
As I research in internet to find some suitable solution, I found these finest tricks on how to force a download a pdf. – by adding the following code into your httaccess file.
FilesMatch "\.(pdf|PDF)"
ForceType application/pdf
Header set Content-Disposition attachment
</FilesMatch>
The code will match perfectly for both lower case and upper case PDF extension by using regular expression and OR operator in the following line.
<FilesMatch "\.(pdf|PDF)">
And thats it… You have now the control in Forcing PDF to download.
Hope that helps
As I research in internet to find some suitable solution, I found these finest tricks on how to force a download a pdf. – by adding the following code into your httaccess file.
FilesMatch "\.(pdf|PDF)"
ForceType application/pdf
Header set Content-Disposition attachment
</FilesMatch>
The code will match perfectly for both lower case and upper case PDF extension by using regular expression and OR operator in the following line.
<FilesMatch "\.(pdf|PDF)">
And thats it… You have now the control in Forcing PDF to download.
Hope that helps
