hugo-embed-pdf-shortcode
hugo-embed-pdf-shortcode copied to clipboard
Provide option to allow users to download the PDF file
What? Provide a option to allow the user to download the PDF file.
Why? Sometimes I need to publish PDF in “secure mode” (I mean that people don’t have to can downloading the PDF); other times, I need to publish PDF allowing people to download. Currently, I seem that it isn’t possible to download the PDF; am I wrong?
Originally posted by @nicfab in https://github.com/anvithks/hugo-embed-pdf-shortcode/issues/26#issuecomment-1008236117
What? Provide a option to allow the user to download the PDF file.
Why? Sometimes I need to publish PDF in “secure mode” (I mean that people don’t have to can downloading the PDF); other times, I need to publish PDF allowing people to download. Currently, I seem that it isn’t possible to download the PDF; am I wrong?
Originally posted by @nicfab in #26 (comment)
Thank you. I will much appreciate your effort to develop a solution.
Hi there,
Currently, I seem that it isn’t possible to download the PDF; am I wrong?
The author of this blog, @SuryaThiru seemed to find the solution, maybe you want to have a look to the code?
- blog: https://suryathiru.github.io/cv
- source code: https://github.com/SuryaThiru/portfolio
Please take the time to report here if you find a solution, and I may submit a PR
Hi there,
Currently, I seem that it isn’t possible to download the PDF; am I wrong?
The author of this blog, @SuryaThiru seemed to find the solution, maybe you want to have a look to the code?
- blog: https://suryathiru.github.io/cv
- source code: https://github.com/SuryaThiru/portfolio
Please take the time to report here if you find a solution, and I may submit a PR
I tried, but it didn't work for me.
I'm having a look right now. The relevant commit is here: https://github.com/SuryaThiru/portfolio/commit/dc1d16be49b0420df6127321e3370be1ba6be455
Note that the PDF url is hardcoded, I would like to avoid that. I'll report here if I find a way
I'm having a look right now. The relevant commit is here: SuryaThiru/portfolio@dc1d16b
Note that the PDF url is hardcoded, I would like to avoid that. I'll report here if I find a way
Thank you.
Firstly, indeed, the PDF URL is hardcoded into the layouts/shortcodes/embed-pdf.html
and so I should modify it each time.
Secondly, I need to embed more than one PDF file on a page, and I seem that the solution doesn't allow what I need.
Firstly, indeed, the PDF URL is hardcoded into the
layouts/shortcodes/embed-pdf.html
This should be fixed with a {{ .Get "url" }}
at the right place, I'll give a try in the next days
Firstly, indeed, the PDF URL is hardcoded into the layouts/shortcodes/embed-pdf.html
This should be fixed with a
{{ .Get "url" }}
at the right place, I'll give a try in the next days
Solved with replacing the line 63 with
<a href="{{ .Get "url" }}" download>
This update is included in this fork: https://github.com/RoneoOrg/hugo-shortcode-roneo-embed-pdf
I will use it to check if everything works fine, and will push a PR. Please feel free to ping me in a month if I do not provide this PR
Firstly, indeed, the PDF URL is hardcoded into the layouts/shortcodes/embed-pdf.html
This should be fixed with a
{{ .Get "url" }}
at the right place, I'll give a try in the next daysSolved with replacing the line 63 with
<a href="{{ .Get "url" }}" download>
This update is included in this fork: https://github.com/RoneoOrg/hugo-shortcode-roneo-embed-pdf
I will use it to check if everything works fine, and will push a PR. Please feel free to ping me in a month if I do not provide this PR
I understand that it is sufficient to put the following folders locally:
-
layouts/shortcodes/embed-pdf.html
; -
static/js/pdf-js
Is it so? Is the only files and folders to add locally?
Is the only files and folders to add locally?
Yes that's it. I personally use Hugo's Theme Component, it's a little bit harder to set up but easier to update
Thank you so much @RoneoOrg and @nicfab . I will try to spend some time with this and merge the PR.
Haven't been able to spend enough time on this due to my day job.
@RoneoOrg I tried as you said but, unfortunately, it didn't work. I will wait for some further intervention by you and @anvithks Thanks a lot.
@RoneoOrg I tried as https://github.com/anvithks/hugo-embed-pdf-shortcode/issues/27#issuecomment-1200388792 but, unfortunately, it didn't work.
More info could be useful to help debugging