PDF download fails ...
By the sound of it, the PDF download isn't "failing", it's just not being saved with a .pdf
file extension. This is probably only a "problem" on Windows, that requires the file extension in order to determine the file type. As I understand it, Mac users will still be able to open the file without issue.
The fact that the file is being saved without an extension implies the URL linking to the file is also without the appropriate file extension.
You can (as a user) improve this situation by configuring your browser to always prompt for file downloads (recommended, although rarely the default configuration) - you can then simply rename the file in the "Save As..." dialogue (which I would often do anyway, as downloaded files are rarely named how you would like them to be).
AddType application/octet-stream .pdf
It is arguably incorrect behaviour to force a file download by setting the mime-type to application/octet-stream
. This is very outdated in my opinion. This is simply a mime-type that the browser is probably unable to open, so as a last resort offers it for download in the hope that you know what to do with it.
The "correct" way to force a download would be to still set the correct mime-type (ie. application/pdf
in the case of PDF files) but to also set the Content-Disposition: attachment; ...
HTTP response header (as @Stephen suggests). It is the attachment
part that forces a download in all modern browsers and the Content-Disposition
header also always the "website" to set a recommended file name when the URL could be set to something completely different (this is still editable if you have the browser "prompt" for file downloads).
.pdf
not on the download link, but manually adding fixes the problem?.pdf
manually. After this the file becomes to be opened with reader software. Without adding of.pdf
on trying to open the file, Windows means, the file is unknown and i should select a software to open such files.