https://github.com/theme-next/theme-next-pdf
PDF.js for NexT.
https://github.com/theme-next/theme-next-pdf
module pdf theme-next
Last synced: 10 months ago
JSON representation
PDF.js for NexT.
- Host: GitHub
- URL: https://github.com/theme-next/theme-next-pdf
- Owner: theme-next
- License: lgpl-3.0
- Created: 2018-11-06T18:00:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-08T14:07:55.000Z (about 6 years ago)
- Last Synced: 2024-02-23T21:37:27.601Z (over 2 years ago)
- Topics: module, pdf, theme-next
- Language: JavaScript
- Homepage: https://github.com/mozilla/pdf.js
- Size: 4.47 MB
- Stars: 18
- Watchers: 13
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PDF.js for NexT
Introduce
This is a plugin that allows to preview PDF files in the blog pages.
If the browser supports embedded PDFs natively, NexT will create a `` tag and include the PDF file on your website. Otherwise it will create a `` tag and uses PDF.js by @mozilla to render the pdf file.
Follow the guide below to install dependencies.
Installation
Step 1 → Go to NexT dir
Change dir to **NexT** directory. There must be `layout`, `source`, `languages` and other directories:
```sh
$ cd themes/next
$ ls
_config.yml crowdin.yml docs gulpfile.js languages layout LICENSE.md package.json README.md scripts source
```
Step 2 → Get module
Install module to `source/lib` directory:
```sh
$ git clone https://github.com/theme-next/theme-next-pdf source/lib/pdf
```
Step 3 → Set it up
Enable module in **NexT** `_config.yml` file:
```yml
# PDF tag
# NexT will try to load pdf files natively, if failed, pdf.js will be used.
# So, you have to install the dependency of pdf.js if you want to use pdf tag and make it available to all browsers.
# See: https://github.com/theme-next/theme-next-pdf
pdf:
enable: true
# Default height
height: 500px
```
Usage
In order to embed PDF files in the article, you just need to create an `pdf` tag with the URL of your local PDF file, e.g.
```
{% pdf /path/to/your/file.pdf %}
```
Notice: Do not use cross-origin PDF files, it might be blocked by the CORS policy.
Enjoy it!
Update
```sh
$ cd themes/next/source/lib/pdf
$ git pull
```