Search code examples
pdfmarkdownjekyllfile-conversion

Create a PDF out of a complete Jekyll page with TOC


I created a Jekyll page hosted on GitHub. This page is nothing but a step-by-step guide. I'd like to have all the content (i.e. all the markdown files/the content from within the pages folder) automatically generated as pdf with a TOC. Yes, there are already some questions on that on the board (e.g. here) but none of them (nor my internet research) provides a tutorial-like guidance on how to really implement it end to end and generate the pdf. Can someone give guidance (preferably with a free to use library, so not e.g. Prince).


Solution

  • Simply host your website on GitHub Pages or Netlify or even localhost, then use wkhtmltopdf to convert a page to a PDF, like:

    wkhtmltopdf https://username.github.io output.pdf
    

    For detailed usage see man wkhtmltopdf.