HTML+CSS to PDF in Node.JS
JavaScript Makefile
Latest commit 745879d Sep 6, 2015 @LoicMahieu Update
Failed to load latest commit information.
lib Save directly to the target file Sep 24, 2013
test update Sep 24, 2013
.gitignore update Sep 16, 2013
Makefile update Sep 24, 2013 Update Sep 6, 2015
index.js Initial commit Sep 15, 2013
package.json release 0.0.5 Sep 24, 2013

Deprecation warning

deprecated This module is old and the API is not really consistent. I recommend you to use:


Create PDFs using plain old HTML+CSS. Uses wkhtmltopdf on the back-end which renders HTML using Webkit.

Hightly inspired by PDFKit written in Ruby



npm install pdfkit



// PDFKit support multiples types (url, file, html) and any options for wkhtmltopdf
// run `wkhtmltopdf --extended-help` for a full list of options
var PDFKit = require('pdfkitjs');

pdf = new PDFKit('url', '');

pdf.toFile('google.pdf', function (err, file) {
  console.log('File ' + file + ' written');


PDFKit(type, url_file_or_html[, options[, spawnOptions[, logger]]])

options : Object corresponding on wkhtmltopdf arguments. run wkhtmltopdf --extended-help for a full list of options

spawnOptions : Options passed to child_process.spawn except exec who is the path to the wkhtmltopdf binary. (Default: wkhtmltopdf)

  • url
new PDFKit('url', '')
  • file
new PDFKit('file', 'path/to/some.html')
  • html
new PDFKit('html', '<h1>Hello</h1>')


You can pass a logger object that implemnts log, warn, debug methods. Default logger:

var baseLogger = {
  log: console.log,
  warn: console.warn,
  debug: console.log

To silent all logs, you can pass false.




Copyright (c) 2010 Loïc Mahieu.