how to set a pdf file so that it can display?
Dicky1 opened this issue · 14 comments
@Dicky1 have you followed the steps to setup the short code correctly?
Is this on your local machine or a VM?
From the error it seems that the PdfJsLib is blocked.
@Dicky1
After you have setup the shortcode correctly you have to place the pdf file in the content folder where the document exists and specify the relative path to that folder.
For ex:
if your hugo site is in a folder called blog-hugo this would be an example code.
This would be a sample document /blog-hugo/content/demo-page/index.md
Your pdf file should be in the same folder as follows:
/blog-hugo/content/demo-page/LAPORAN HASIL MONITORING KEAMANAN SIBER TAHUN 2020.pdf
and in the index.md file you should use the shortcode as follows:
{{< embed-pdf url="./LAPORAN HASIL MONITORING KEAMANAN SIBER TAHUN 2020.pdf" >}}
Another suggestion: avoid having spaces in the file name of the PDF file. You can use -
or _
like
LAPORAN_HASIL_MONITORING_KEAMANAN_SIBER_TAHUN_2020.pdf
Already, is it possible that my pdf file is too big?
Already, is it possible that my pdf file is too big?
What is the size of the file?
I do not think the error that you are seeing is because of that.
is it possible to push your code and share the repository with me?
I can test it locally and check if there is something that needs to be fixed.
@Dicky1 Got it. I pulled your repository.
One thing that needs to be fixed in your repository is in the JS folder here https://github.com/Dicky1/hugo-blog/tree/main/static/js
The build
, web
folders and LICENSE
should be inside a folder called pdf-js
.
You can take a look at the demo here
Your pdf file is OK.
I checked it on my local dev env. The filename without spaces is not a problem.
I've moved the file in the pdf-js folder I think it's still the same
may check my latest repository
oke solved thanks
Closing since the issue was resolved.