Hugo Embed Pdf Shortcode screenshot

Hugo Embed Pdf Shortcode

Author Avatar Theme by Anvithks
Updated: 20 Mar 2023
146 Stars

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/)

##Overview

This product analysis is about a Hugo Shortcode called “embed-pdf” that allows users to embed a PDF file in a page on their Hugo website. It is developed using the PDF.js library by Mozilla. The analysis includes information about the setup, usage, FAQ, and support for this shortcode.

##Features

  • Embed PDF files in pages on a Hugo website
  • Option to hide pagination
  • Option to render a specific page number
  • Option to hide the loading spinner while the document loads
  • Supports local file embed (not absolute URLs from remote servers)
  • Two installation methods: Git submodule or cloning the repository
  • Compatibility with Hugo based websites only

##Installation

###Method 1 - Install as a Git submodule

  1. Add the “embed-pdf” shortcode as a Git submodule.
  2. Modify the config.toml file in your Hugo website directory to include the shortcode.
  3. Refer to the Hugo documentation for more information about using theme components.

###Method 2 - Clone the repository

  1. Clone the “embed-pdf” repository.
  2. Copy the embed-pdf.html file from the ./layouts/shortcodes directory in the repository to the ./layouts/shortcodes directory in your Hugo website directory.
  3. If you don’t have a ./layouts/shortcodes directory, create one.
  4. Copy the pdf.js library files from the ./static/js/pdf-js directory in the repository to the ./static/js directory in your Hugo website directory.
  5. If you don’t have a ./static/js directory, create one.

##Summary

The “embed-pdf” shortcode is a useful tool for Hugo website owners who want to include PDF files in their pages. It offers several options for customizing the display of the embedded PDF, such as hiding pagination, rendering a specific page number, and hiding the loading spinner. The shortcode can be installed as a Git submodule or by cloning the repository, making it easy to integrate into a Hugo based website. The shortcode is supported and maintained by the developer, and there is a dedicated support channel for bug reports and feature requests. The “embed-pdf” shortcode is used by various websites, including Dirk’s Changelog and SYSADMIN. The shortcode is licensed under the MIT license.