This is a Jekyll plugin to enable the creation of PDFs along side the usual html documents.
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. |
-
_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.
-
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.
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.