Generate tagged PDFs from your Eleventy site

Overview

eleventy-plugin-prince-pdf

This plugin makes it easy to generate tagged PDFs from webpages in your Eleventy site, using Prince.

What this does

This plugin runs a function after Eleventy is finished rendering your website.

It spins up a temporary web server, so that Prince can load the URLs as if they were on a real website. This means absolute URLs beginning with / (eg. /css/style.css/) will work.

Then, Prince will convert each of the supplied paths to render (from the pathsToRender array in the supplied config) and write the PDFs to the output directory.

Installation

This is not on the npm registry just yet, install with the GitHub repo:

npm i https://github.com/larryhudson/eleventy-plugin-prince-pdf

Add it to your .eleventy.js with a list of paths you want to render to PDF:

const PrincePdfPlugin = require('eleventy-plugin-prince-pdf')

module.exports = function (eleventyConfig) {

  eleventyConfig.addPlugin(PrincePdfPlugin, {
    pathsToRender: [
      { htmlPath: "/hello/", outputPath: "/hello.pdf" },
      { htmlPath: "/another-pdf-page/", outputPath: "/another-pdf.pdf" },
    ],
    serverPort: 8090 // optional - set port of prince web server
  });

For each page in pathsToRender:

  • htmlPath should be a absolute path (starting with a /), pointing to the webpage that you want to convert to PDF. For example, /hello/ will try to convert [OUTPUT_DIR]/hello/index.html.
  • outputPath should be a absolute path (starting with a /), relative to your output directory. This is where the PDF will be written to.

The serverPort option can be used to set the port of the web server that Prince uses when it is converting HTML to PDF. The server port defaults to 8090.

Configuration

At the moment this plugin does not offer any configuration.

It sets Prince's configuration to use the PDF/UA-1 profile, so that it exports a tagged PDF that works with assistive technology.

You might also like...

A peculiar little website that uses Eleventy + Netlify + Puppeteer to create generative poster designs

A peculiar little website that uses Eleventy + Netlify + Puppeteer to create generative poster designs

Garden — Generative Jamstack Posters "Garden" is an experiment in building creative, joyful online experiences using core web technologies. 🧱 Buildin

Jun 13, 2022

A markdown-it plugin that process images through the eleventy-img plugin. Can be used in any projects that uses markdown-it.

markdown-it-eleventy-img A markdown-it plugin that process images through the eleventy-img plugin. Can be used in any projects that use markdown-it. F

Dec 20, 2022

Opiniated Eleventy starter based on the workflow suggested by Andy Bell's

Eleventy starter Very opiniated Eleventy starter based on the workflow suggested by Andy Bell's https://buildexcellentwebsit.es/. Eleventy starter Pre

Dec 31, 2022

A crawler that crawls the site's internal links, fetching information of interest to any SEO specialist to perform appropriate analysis on the site.

Overview 📝 It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Apr 22, 2022

A crawler that crawls the site's internal links, fetching information of interest to any SEO specialist to perform appropriate analysis on the site.

Overview 📝 It is a module that crawls sites and extracts basic information on any web page of interest to site owners in general, and SEO specialists

Apr 22, 2022

A simple site to generate useful resources for Gitpodification, including "open in gitpod" buttons and sample configuration scripts

Gitpodify A simple portal to generate "open in Gitpod" links Contributing There is a list of suggested repositories in app/routes/index.tsx. Feel free

Nov 7, 2022

Generate deterministic fake values: The same input will always generate the same fake-output.

Generate deterministic fake values: The same input will always generate the same fake-output.

import { copycat } from '@snaplet/copycat' copycat.email('foo') // = '[email protected]' copycat.email('bar') // = 'Thurman.Schowalter668@

Dec 30, 2022

This site compares your GitHub Profile to your friends, and analyses and tells your GitHub profile score too.

GitHub ⚔️ Duel Deployed at 🚀 : https://githubduel.vercel.app/ Compare your GitHub profiles with your friends It gives score to GitHub profile based o

Nov 21, 2022

docsQL - Getting an overview over your Markdown file in your Jamstack site

docsQL - Getting an overview over your Markdown file in your Jamstack site

docsQL Getting an overview of your Jamstack Markdown files. Demo Play with: https://peterbe.github.io/docsql/ You're supposed to run docsQL with your

Jan 3, 2023
Comments
  • Feature Request: Timed Snapshots

    Feature Request: Timed Snapshots

    First of all, fantastic idea to make a share code visually with a simple PDF. I believe it's well worth the notion of how most code reviews, personal or professional, never happen visually. Even GitHub just "sees" your work as a "checkbox square"

    I hope to change that notion, and that you can have a directory of "visual change logs" that accompany such achievements, and help developers just pull up a PDF to show the IRL differences that we interface with, not the DIFF-messages you pull in.

    Ideally it should work as a true-false configuration that, just like an ordinary camera, takes snapshots of your url's every X minutes | hours | days | weeks | months | years even, and put them into a folder named accordingly.

    A catablog of work done on auto-pilot, so you can continue not using this plugin to use it optimally. Right? It's meant to offload the work for you and automating the "hard parts" of work; Communication

    It would greatly help re-use my actual work, in combination with all the pushing and pulling repositories, that you can put them side by side easily, isolated, and have a chat with someone on the visual plane of change that actually happened.

    opened by alolalo 2
Owner
null
A plugin that will automatically download PDFs of zotero items from sci-hub

Zotero Scihub This is an add-on for Zotero and Juris-M that enables automatic download of PDFs for items with a DOI. Quick Start Guide Install Downloa

Ethan Willis 1.9k Jan 8, 2023
A JavaScript-powered CLI for converting HTML into PDFs

Print Ready by Nicholas C. Zakas If you find this useful, please consider supporting my work with a donation. Description A JavaScript-powered CLI for

Human Who Codes 86 Dec 18, 2022
A small library aims to improve better tagged-unions/discriminated-unions supporting for TypeScript

coproduct A small library aims to improve better tagged-unions/discriminated-unions supporting for TypeScript Benefits Small bundled size(just 1kb) Ea

工业聚 29 Aug 15, 2022
Maybe better conditionals feat. tagged template literals

condicional Maybe better conditionals Report Bug · Request Feature About The Project ⚠️ `condicional` is based on a PEG grammar and is not battle-test

null 3 Oct 12, 2022
Eleventy base project

Project base for Eleventy Sites Includes static page template, blog post template, post feed, pagination, tags and RSS. Also includes gulp setup for S

Andy Bell 70 Dec 21, 2022
Group and sort Eleventy’s verbose output by directory (and show file size with benchmarks)

eleventy-plugin-directory-output Group and sort Eleventy’s verbose output by directory (and show file size with benchmarks). Sample output from eleven

Eleventy 16 Oct 27, 2022
A demo to show how to re-use Eleventy Image’s disk cache across Netlify builds.

Re-use Eleventy Image Disk Cache across Netlify Builds Live Demo This repository takes all of the high resolution browser logos and processes them thr

Eleventy 9 Apr 5, 2022
A tiny script and component intended to be used with Astro for generating images with eleventy-img.

Astro + eleventy-img A tiny script and component intended to be used with Astro for generating images with eleventy-img. It also supports creating blu

Erika 36 Dec 16, 2022
Use macro-based Nunjucks components with Eleventy and Storybook.

eleventy-nunjucks-storybook Use macro-based Nunjucks components with Eleventy and Storybook. Links See Using Storybook with Nunjucks components in Ele

Ashur Cabrera 11 Dec 15, 2022
An Eleventy wrapper for type supported configurations

Shareable Eleventy configuration strap. The module can be dropped in to your .eleventy.js configuration file for Typed supported configuration options.

ΝΙΚΟΛΑΣ 5 Jun 17, 2022