andream16 / hugo-embed-pdf-shortcode

A shortcode for Hugo(https://gohugo.io/) which allows you to embed a PDF file in a page using Pdf.js (https://mozilla.github.io/pdf.js/)

Home Page:https://hugo-embed-pdf.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License visitors

hugo-embed-pdf-shortcode


Table of Contents


Introduction

[Back to Top]

This is a Hugo Shortcode developed for use in Hugo based websites. 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.

hugo-embed-pdf-shortcode cover

Setup

[Back to Top]

Note: This shortcode is for use in Hugo based websites. It will not work anywhere else.

  1. Clone this repository

git clone https://github.com/anvithks/hugo-embed-pdf-shortcode.git
cd hugo-embed-pdf-shortcode
  1. Copy the file .layouts/shortcodes/embed-pdf.html to ./layouts/shortcodes in your Hugo website directory.

Note: If you do not have a ./layouts/shortcodes directory you can create it.

cp ./layouts/shortcodes/embed-pdf.html /path/to/your/hugo/website/layouts/shortcodes

  1. Copy the pdf.js library files from ./static/js/pdf-js to ./static/js in your Hugo website directory.

Note: If you do not have a ./static/js directory you can create it.

cp -R ./static/js/pdf-js /path/to/your/hugo/website/static/js/

Usage

[Back to Top]

In your Hugo website place the following shortcode in any of the markdown pages.

{{< embed-pdf url="./path/to/pdf/file/example.pdf" >}}

Parameters

  • url (required) : The relative location of the file.
  • hidePaginator (optional): Boolean which expects true or false. Hides the paginator for single page documents.

Note: 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:

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

License

[Back to Top]

License

About

A shortcode for Hugo(https://gohugo.io/) which allows you to embed a PDF file in a page using Pdf.js (https://mozilla.github.io/pdf.js/)

https://hugo-embed-pdf.netlify.app/

License:MIT License


Languages

Language:JavaScript 89.6%Language:CSS 7.3%Language:HTML 3.1%