43 lines
1,012 B
Markdown
43 lines
1,012 B
Markdown
# Eleventy Plugin PDF
|
|
|
|
A plugin for [Eleventy](https://www.11ty.dev/) 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`:
|
|
|
|
```js
|
|
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.
|
|
|
|
```yaml
|
|
---
|
|
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" | |