Skip to content

A shortcode for Hugo which allows you to embed a PDF file in a page using PDF.js using Hugo Modules

License

Notifications You must be signed in to change notification settings

AlanTanner/pdfjs-hugo-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License visitors

pdfjs-hugo-module

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.

Table of Contents


Introduction

[Back to Top]

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.

Setup

[Back to Top]

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"

Usage

[Back to Top]

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" >}}

Parameters

  • url (required) : The relative location of the file.
  • hidePaginator (optional): Boolean which expects true or false. 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 or false. 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. ==

FAQ

[Back to Top]

Support

[Back to Top]

You an reach me at:

You can reach the orignal author of hugo-embed-pdf-shortcode at:

For any bugs, enhancement requests, feature requests please raise issues here

License

[Back to Top]

License

About

A shortcode for Hugo which allows you to embed a PDF file in a page using PDF.js using Hugo Modules

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages