Skip to content

bogado/make_pdf-jekyll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Make pdf Jekyll plugin.

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:          sudo dnf install rubygem-{irb,rake,rbs,rexml,typeprof,test-unit} ruby-bundled-gems               # Include background.
    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.

About

Jekyll plugin to create PDFs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages