
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
wkhtmltoimage
Advanced tools
A Node.js wrapper for the wkhtmltoimage command line tool. It converts HTML documents to images using WebKit. This was originally based on node-wkhtmltopdf.
var wkhtmltoimage = require('wkhtmltoimage');
// Optionally specify binary path
var wkhtmltoimage = require('wkhtmltoimage').setCommand(__dirname + '/bin/wkhtmltoimage');
// URL
wkhtmltoimage.generate('http://example.com/', { pageSize: 'letter' })
.pipe(fs.createWriteStream('out.jpg'));
// HTML
wkhtmltoimage.generate('<h1>Hello world</h1>')
.pipe(res);
// output to a file directly
wkhtmltoimage.generate('http://example.com/', { output: 'out.jpg' });
// Optional callback
wkhtmltoimage.generate('http://example.com/', { pageSize: 'letter' }, function (code, signal) {
});
wkhtmltoimage.generate('http://example.com/', function (code, signal) {
});
wkhtmltoimage is just a function, which you call with either a URL or an inline HTML string, and it returns a stream that you can read from or pipe to wherever you like (e.g. a file, or an HTTP response).
There are many options available to wkhtmltoimage. All of the command line options are supported as documented on the page linked to above. The options are camelCased instead-of-dashed as in the command line tool.
There is also an output option that can be used to write the output directly to a filename, instead of returning a stream.
First, you need to install the wkhtmltoimage (included with wkhtmltopdf) command line tool on your system. The easiest way to do this is to download a prebuilt version for your system.
Then install the node module, use npm:
npm install wkhtmltoimage
Be sure wkhtmltoimage is in your PATH when you're done installing. Alternatively, use .setCommand(path) to specify the binary path.
MIT
FAQs
A wrapper for the wkhtmltoimage HTML to Image converter using WebKit
The npm package wkhtmltoimage receives a total of 813 weekly downloads. As such, wkhtmltoimage popularity was classified as not popular.
We found that wkhtmltoimage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.