Skip to content

Files

Latest commit

f446608 · Jan 15, 2025

History

History
This branch is 19 commits behind foliojs/pdfkit:master.

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 18, 2014
Jul 24, 2019
Feb 23, 2014
Jan 15, 2021
Dec 17, 2023
Dec 28, 2024
Dec 14, 2024
Mar 25, 2019
May 29, 2021
Mar 28, 2021
Dec 24, 2024
Jan 12, 2025
Dec 29, 2024
Dec 3, 2023
Dec 19, 2018
Nov 24, 2021
Jul 11, 2021
Jul 11, 2021
Jan 15, 2025
May 6, 2019
Apr 30, 2019

PDFKit Guide

The PDFKit guide can be read a number of ways. The first is online at pdfkit.org. You can also read the guide in PDF form, in this directory or online.

Both the website and the PDF guide are generated from the Markdown files in this directory. Just run npm run docs to generate them. You will need to have ImageMagick 7 installed so the magick command is on your $PATH.

The examples are actually run when generating the PDF in order to show the results inline. The generate.js file in this directory is actually quite short. It parses the markdown files into a tree structure using markdown-js, syntax highlights the code examples using codemirror, compiles and runs the code examples and puts the results inline, and generates the PDF using PDFKit. You can read the generator script source code to get a feeling for how you might do something slightly more complex than the guide itself shows.

The markdown syntax used is pretty much standard, with a couple tweaks.

  1. Code example output is references using the image notation, using the alt text as the example number starting from zero in the current file, and the title as the example output height. E.g. ![x](name "height").

  2. Page breaks are added before h1 and h2s, unless there are two in a row. h3 is treated the same as h2 but can be used to avoid this in the case you need multiple h2s on the same page.

  3. The horizontal rule syntax (* * *) denotes an explicit page break