I have a PDF hosted in a GitHub directory. I have a link to this PDF in my README.md as follows -
[foo](https://github.com/me/bar_repo/foo.pdf)
so that users can find it easily when they access the repository. However when they click the link instead of opening the PDF in the browser or downloading it, the users is brought to the github page with url - https://github.com/me/bar_repo/foo.pdf
- and here they have options to "View Raw", "Open", etc...(and the Open command requires installation of GitHub for windows...sigh).
I simply want to let users view the PDF in the browser or be given the option to download it if they left-click this link, as is usually the case when people click on links for PDFs on the net.
Does anyone know how I can make this happen?
GitHub supports rendering of PDF documents.
Click on the file you wish to download from GitHub to open the individual file. From here, right click the Raw button at the top of the file, select Save Link As… , choose the location on your computer where you want to save the file, and select Save .
To download from GitHub, you should navigate to the top level of the project (SDN in this case) and then a green "Code" download button will be visible on the right. Choose the Download ZIP option from the Code pull-down menu. That ZIP file will contain the entire repository content, including the area you wanted.
You need to link to the raw version. So on the resulting page, context click the Raw
button, and choose Copy link address
and use that URL in your README.
A simpler option should be available since March 17th, 2015:
"PDF Viewing"
Simply browse to a PDF document and we'll render it in your browser like any other file.
From presentations to papers, we've got you covered.
Many thanks to Mozilla and every contributor to PDF.js.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With