I've got a better way.
Install this extension: Etatva Extension
After installing, add this line to view.phtml.
Save it, clear cache, log out, re log in. Go to
System>>Configuration, you should see that extension in left panel. Play with settings so that pdf files can be uploaded in backend.
Then add a new product, upload pdf. Then add a custom attribute, make it visible in front end. In backend, use an anchor tag like this for that custom attribute.
<a href="linkwherecustompdfsare stored" alt="pdfdownloader">PDF Downloader</a>
Save it, refresh front end and Voila!!
You should see a link in front end, clicking on it will download the pdf.
Tested and verified in Magento CE 22.214.171.124 :)