wkhtmlto-installer

Downloads and installs wkhtmltopdf and wkhtmltoimage

Usage no npm install needed!

<script type="module">
  import wkhtmltoInstaller from 'https://cdn.skypack.dev/wkhtmlto-installer';
</script>

README

wkhtmlto-installer

License

npm install wkhtmlto-installer

An NPM installer for wkhtmltopdf and wkhtmltoimageutilitys. The package automatically downloads platform specific wkhtmltopdf binary if not already available as global command.

Basics

This package is fork of wkhtmltopdf-installer that has API to use wkhtmltopdf and wkhtmltoimage.

var path = require('path');
var childProcess = require('child_process');
var binPath  = require('wkhtmltopdf-installer').path.pdf;

var childArgs = [
  path.join(__dirname, 'test.html'),
  path.join(__dirname, 'out.pdf'),
]

childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
  // handle results
})

Troubleshooting

This package should support windows, linux and osx as well. For linux you may need to install some additional packages, see more here.

There is currently support just for x64.

wkhtmltodf downloads page provides different packages for every linux distribution and version. This project currently just grabs the binary from Linux (Debian Wheezy). These binaries seems to work on Ubuntu as well.

License

MIT