Git Product home page Git Product logo

fdesena / hugo-embed-pdf-shortcode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anvithks/hugo-embed-pdf-shortcode

0.0 0.0 0.0 3.29 MB

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/

License: MIT License

JavaScript 89.43% CSS 7.32% HTML 3.25%

hugo-embed-pdf-shortcode's Introduction

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

To hide pagination

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

To render a selected page number

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

To hide loading spinner

{{< embed-pdf url="./path/to/pdf/file/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.

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

Who uses Hugo Embed Pdf Shortcode

[Back to Top]

Dirk's Changelog

License

[Back to Top]

License

hugo-embed-pdf-shortcode's People

Contributors

anvithks avatar jeremybohannon avatar toinetoine avatar dicky1 avatar andream16 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.