const captureScreenshot = (svgString) => new Promise((resolve, reject) => {
Chrome.New().then((tab) => {
return Chrome({ tab });
}).then((client) => {
client.send('Emulation.setVisibleSize', { height, width })
.then(() => {
client.Page.loadEventFired(() => {
client.Page.captureScreenshot().then(data => {
const img = new Buffer(data.data, 'base64');
const tab = client.tab;
resolve(img);
}).catch(err => reject(err));
});
client.Page.enable();
client.once('ready', () => {
client.Page.navigate({ url: 'about:blank' })
.then((result) => {
client.Page.setDocumentContent({
frameId: result.frameId,
html: svgString,
})
});
});
})
})
});
The problem I'm facing is that the resulting PNG buffer has a white background instead of the expected transparent background.