PDFKitJs
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
Install
PDFKit
npm install pdfkit
wkhtmltopdf
Hello
Usage
// PDFKit support multiples types (url, file, html) and any options for wkhtmltopdf// run `wkhtmltopdf --extended-help` for a full list of optionsvar PDFKit = ; pdf = 'url' 'http://google.com'; pdf;
API
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
'url' 'http://google.com'
file
'file' 'path/to/some.html'
html
'html' '<h1>Hello</h1>'
Logger
You can pass a logger object that implemnts log
, warn
, debug
methods. Default logger:
var baseLogger = log: consolelog warn: consolewarn debug: consolelog;
To silent all logs, you can pass false
.
Output
TODO
Copyright
Copyright (c) 2010 Loïc Mahieu.