I have a document I'm writing with bookdown. This document will only have a HTML version. However, I want to make a PDF file available for readers to download. I would like to make it available without placing a link in the text, that is, I would like to use the icon in the top bar of the book.
Everything is working locally. However, in GitHub I'm having problems. In GitHub, clicking on the PDF icon shows 404 error. But, locally, it works.
Notes:
In GitHub all the content of the page is in docs/;
The PDF file was named _ main.pdf and was placed inside the docs/ directory.
Note: I already tried to download: 'pdf' and download: ["_main.pdf", "PDF"] but I did not succeed. It works locally but when I send the content to GitHub it works everything; there is only an error clicking on the PDF icon in the top bar.
Below is my file _output.yml:
bookdown::gitbook:
css: style.css
config:
toc:
collapse: none
edit:
link: https://github.com/prdm0/aulas_computacional/edit/master/%s
text: "Editar"
sharing:
facebook: yes
twitter: yes
github: yes
google: no
linkedin: no
weibo: no
instapaper: no
vk: no
all: ['facebook', 'google', 'twitter', 'linkedin']
toolbar:
position: fixed
download: 'docs/_main.pdf'
search: yes
You still have _main.pdf in your docs folder which is rendered by github pages.
This is the one access by the online bookdown; I don't know what you tried, but I meant trying setting this one to main.pdf. You may need to regenerate the book I guess.
I know, I still have _main.pdf because before my question I had already tried main.pdf, that is, I had already thought before asking here in the group.
No this is normal. I just modified the name of the file in the docs folder to see why _main.pdf and main.pdf were not working. I manage to create a working link to pdf by changing the whole name to presentation.pdf. I did not touch to the bookdown files. So the link from the bookdown button did not get modified, but you can use my link above to download the pdf file.
You know need to modify accordingly the _output.yml file with a name to pdf that is ok with you and not main.pdf. Regenerate the bookdown to update the docs folder. Then check the link point to the new file.
I think you provide a mixed of those and it may create the issue.
I just try to help without rebuilding your bookdown. Know that the pdf file is accessible from gtihub pages, you just have to correctly configure your bookdown so that the button gets the correct link.