Best way to download a pdf
- Started
- Last post
- 11 Responses
- ksv123
Sound silly, but I have some links that basically link to a pdf and it pops the little window open to view or save. Now for the dumb asses that get confused by this. How else would you deliver this pdf to the user?
- scarabin0
alt-click to download something from a link
- acescence0
use a php script...
<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');// The PDF source is in original.pdf
readfile('original.pdf');
?>
- ksv1230
acescene, how would I implement this. the site is flash based
- version30
view pdf, save zip or rar
- acescence0
put that script in a file and call that file from flash. just make sure there's no space in the file before <?php
- acescence0
this is the php source the above page calls...
- ksv1230
yeah, but that still pops the window that asks what the user wants to do. View or save pdf. I need this to be as dumbed down as possible.
- acescence0
that's unfortunately the way IE and Firefox deal with it. Safari will just download it via this script, otherwise it will view it with the in-browser plugin. Chrome downloads the file no matter what.
- raf0
Safari downloads every shit you click on that has mimetype set for download rather than display, one of the reasons I rarely use it.
- DoktorDavid0
Hmmm... current Chrome/Acrobat tries desperately to load the PDF and subsequently fails - I have to remember to alt/right-click, Save As...