A plugin for 11ty that generates a pdf file from a template
Go to file
2025-06-08 21:01:18 +02:00
src Initial commit. 2025-06-08 19:05:19 +02:00
.gitignore Initial commit. 2025-06-08 19:05:19 +02:00
eleventy.config.js Initial commit. 2025-06-08 19:05:19 +02:00
package-lock.json Initial commit. 2025-06-08 19:05:19 +02:00
package.json Add "usage" section in readme.md 2025-06-08 21:01:18 +02:00
README.md Add "usage" section in readme.md 2025-06-08 21:01:18 +02:00

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"