This is a fork of hugo-embed-pdf-shortcode created by Anvinth KS optimized for use as a Hugo Module. it uses the latest pre-built version of the PDF.js source code from mozilla/pdfjs-dist.
This is a Hugo Shortcode inside of a Hugo Module that uses the latest pre-built verion of PDF.js from Mozilla. This shortcode allows you to embed a PDF file in a page on your Hugo website. It is developed using the PDF.js library by Mozilla.
click here to read the offical documentation on using Hugo Modules.
Init your project as a hugo module if not already.
hugo mod init <your_repo_url>
Add this module to your config. The following is an example of toml, and the same is true for yaml and json.
[[module.imports]]
path = "github.com/AlanTanner/pdfjs-hugo-module"
In your Hugo website place the following shortcode in any of the markdown pages.
{{< embed-pdf url="<path>/example.pdf" >}}
To hide pagination
{{< embed-pdf url="<path>/example.pdf" hidePaginator="true" >}}
To render a selected page number
{{< embed-pdf url="<path>/example.pdf" renderPageNum="5" >}}
To hide loading spinner
{{< embed-pdf url="<path>/example.pdf" hideLoader="true" >}}
- url (required) : The relative location of the file.
- hidePaginator (optional): Boolean which expects
true
orfalse
. Hides the paginator for single page documents. - renderPageNum (optional): Integer which expects any number from
1
up to the last page number in the document. Will render that specific page on initial load. - hideLoader (optional): Boolean which expects
true
orfalse
. Hides the loading spinner while your document loads.
== Currently supports local file embed. If absolute URL from the remote server is provided, configure the CORS header on that server. ==
You an reach me at:
- Twitter : @alanctanner
You can reach the orignal author of hugo-embed-pdf-shortcode at:
- Twitter : @anvith3
For any bugs, enhancement requests, feature requests please raise issues here