I recently created a PDF file with fillable form fields and wanted to post it on my site. The PDF file itself is terrific as you can fill in all the form fields and even submit it via a Submit Form button in the PDF file. Lovely.
Though when I see the link on the page in my web browser and click it, it launches my “browser” PDF reader which doesn’t have the ability to fill in form fields. In fact some ugly message comes up along the lines of “Your PDF contains fillable form fields which is not supported by this viewer.”
Yuck for two reasons. One, users can’t fill it in. And two, I don’t want some ugly warning message in the browser window confronting my visitors.
The solution isn’t using htaccess, java or anything even remotely nasty to force a browser download. In fact, with HTML5 it’s a ONE WORD solution.
All you have to do is add the word download to your <a> tag and if your browser supports it your visitor will get a Download Where? prompt.
Currently works in Firefox, Chrome and Android Chrome and Android Browser; source caniuse.com.
Here’s what the link will look like:
<a href="path/file.pdf" download title="Download PDF">Download</a>