I am trying to convert some html to a png using wkhtmltoimage via nodejs and the node-wkhtml package.
I am able to a pdf without and problem. However, when I try to make a png instead of a pdf, the png is just band of colors instead of what it should be. This reported bug on the project site is very similar to what I am seeing (except I am trying to write a png and the bug is reported for a png).
It seems that the problem should only be present when using stdout on windows. Is there a work around? Is there any way to save the file without using stdout?
var fs = require('fs');
var wkhtml = require('node-wkhtml'),
createWriteStream = require('fs').createWriteStream;
var MyClass = module.exports = function()
{
var png = wkhtml.spawn('png');
png.stdout.pipe(createWriteStream('node_doc.png'));
png.stdin.end('<h1>Hello World</h1>');
}
new MyClass();