0.0
A long-lived project that still receives updates
Allows that some documents, or pages to have a pdf version pre generated.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

Make pdf Jekyll plugin.

Table of Contents
  • Installation
  • How the PDF is created.
  • Using front-matter

This is a Jekyll plugin to enable the creation of PDFs along side the usual html documents.

Installation

Add to your site Gemfile :

# …
group :jekyll_plugins do
    gem 'make_pdf-jekyll'
    # … Other plugins may be here.
end

Then edit your Jekyll configuration.

Warning
The schema here is still in experimental phase. Expect changes until version 1.0 reached.
  1. _config

# …
destination: «some-path» (1)
# …
plugins:
    - make_pdf/jekyll
    # … Other plugins.

make-pdf:
    writer: Chrome                              # Requires `Chrome-headless-render-pdf` to be installed and on the path.

    # Bellow are the default settings :
    write-by-default: false                     # If set to true enables the generation
    source: file:                               # Where to get the sources.
    input-base-path: «some-relative-path»       # base path common to all input files.
    output-base-path: «some-path»               # base path where the pdf are stored.
    input-scheme: «http|file»                   # How to access the input HTML.
    output-dir: «some-path»                     # Path where to store pdf files.

    # Chrome-headless-render-pdf options :
    no-margins: true                            # Do not use margins.
    include-background: true                    # Use backgrounds
    landscape: false                            # Don't use landscape.
    display-header-footer: false                # No header or footer.
    # There are more options for chrome.
  1. This is a limitation, I will update this in the future.

To each document that you want PDFs to be generated add the key make-pdf: true to it’s front-matter. If the option write-by-default is set to true, you can disable the PDF generation with make-pdf: false as well.

How the PDF is created.

The option 'writer' defines the strategy used to generate the PDFs. The only working option at the moment is 'Chrome', that uses 'Chrome-headless-render-pdf' to create the PDF. This may not work correctly, depending on how the asset files are specified in the output 'html' files.

You can also use your 'published' version, by setting both source: and base-source: configurations. Use source: http:// and base-source: «baseurl» to point the headless chrome to the correct URL.

Using front-matter

You can use the front-matter properties on your pages to setup any of the options set on the _config file. Any option that starts with make-pdf- is read as targeted for this plugin. Options defined on pages will take precedence over globally defined ones.

For example, setting make-pdf-include-background: false on you front-matter will stop chrome from printing the backgrounds for this document.

Other configuration options
make-pdf:

Enable or disable pdf generation for this page.

make-pdf-name:

Use a different file name for the PDF of this page. Useful for "index" pages, for example.