pagerender.js:
var page = require('webpage').create(),
system = require('system'),
address;
if (system.args.length <= 2) {
console.log('Usage: pagerender.js <some URL> <image name>');
phantom.exit();
}
address = system.args[1];
image = system.args[2];
page.open(address, function(status) {
console.log("Status: " + status);
if(status === "success") {
page.render(image);
}
phantom.exit();
});
Command:$ phantomjs pagerender.js http://smashingtheory.blogspot.com test.png