I am using selenium/phantomjs to create png files of html in python. Is there a way to generate the png from an html string or filehandle (instead of a website)? I\'ve searc
PhantomJS
var page = require('webpage').create();
page.content = 'Hello world
';
page.render('name.png');
You set the content of the page using page.content
Then you render it using page.render
Example using phantomjs-node
phantom.create(function (ph) {
ph.createPage(function (page) {
page.set('viewportSize', {width:1440,height:900})
//like this
page.set('content', html);
page.render(path_to_pdf, function() {
//now pdf is written to disk.
ph.exit();
});
});
});