| src | ||
| .gitignore | ||
| eleventy.config.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
Eleventy Plugin PDF
A plugin for Eleventy that generates a pdf file from a template
Installation
npm install --save-dev eleventy-plugin-pdf
Open up your Eleventy config file (probably eleventy.config.js) and use addPlugin:
import eleventyPluginPDF from "eleventy-plugin-pdf";
export default function (eleventyConfig) {
eleventyConfig.addPlugin(eleventyPluginPDF);
};
Usage
Add the extension ".pdf" to the permalink of the template's front matter.
---
permalink: "my-file.pdf"
---
Options
The options object can contain:
| Name | Description | Default |
|---|---|---|
| tempDir | Directory where the temporary files are created | "dist" |
| debug | Keep the generated temporary html file for debugging | false |
| format | Default pdf format | "A4" |
| margin.top | PDF top margin | "1cm" |
| margin.right | PDF right margin | "1.25cm" |
| margin.bottom | PDF bottom margin | "1cm" |
| margin.left | PDF left margin | "1.25cm" |