Not sure if it meets your requirements but you could also use the button plugin, see
https://www.dokuwiki.org/plugin:button.
I did the following to test it:
- install the plugin
- copy an PDF file (example.pdf) to my media folder in namespace wiki
- added this wiki code to a page:
[[{}wiki:example.pdf|Title of the link]]
Another idea would be to just put a link into a wrap download box (see wrap plugin).