# hugo-embed-pdf-shortcode
**Repository Path**: eric96may/hugo-embed-pdf-shortcode
## Basic Information
- **Project Name**: hugo-embed-pdf-shortcode
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-07-05
- **Last Updated**: 2021-07-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](http://badges.mit-license.org) 
# hugo-embed-pdf-shortcode
---
# Table of Contents
* [Online Demo](https://hugo-embed-pdf.netlify.app/)
* [Introduction](#introduction)
* [Setup](#setup)
* [Usage](#usage)
* [FAQ](#faq)
* [Support](#support)
* [License](#license)
---
## Introduction
[\[Back to Top\]](#table-of-contents)
This is a [Hugo Shortcode](https://gohugo.io/extras/shortcodes/) developed for use in [Hugo](https://gohugo.io/) 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](https://mozilla.github.io/pdf.js/) library by Mozilla.

## Setup
[\[Back to Top\]](#table-of-contents)
**Note:** This shortcode is for use in Hugo based websites. It will not work anywhere else.
1. Clone this repository
```shell
git clone https://github.com/anvithks/hugo-embed-pdf-shortcode.git
cd hugo-embed-pdf-shortcode
```
2. 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.
```shell
cp ./layouts/shortcodes/embed-pdf.html /path/to/your/hugo/website/layouts/shortcodes
```
3. 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.
```shell
cp -R ./static/js/pdf-js /path/to/your/hugo/website/static/js/
```
## Usage
[\[Back to Top\]](#table-of-contents)
In your Hugo website place the following shortcode in any of the markdown pages.
```
{{< embed-pdf url="./path/to/pdf/file/example.pdf" >}}
```
To hide pagination
```
{{< embed-pdf url="./path/to/pdf/file/example.pdf" hidePaginator="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.
**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\]](#table-of-contents)
## Support
[\[Back to Top\]](#table-of-contents)
You an reach me at:
- Twitter : [@anvith3](https://twitter.com/anvith3)
For any bugs, enhancement requests, feature requests please raise issues [here](https://github.com/anvithks/hugo-embed-pdf-shortcode/issues)
## License
[\[Back to Top\]](#table-of-contents)
[](http://badges.mit-license.org)
- **[MIT license](http://opensource.org/licenses/mit-license.php)**