25 lines
592 B
JavaScript
25 lines
592 B
JavaScript
|
var page = new WebPage(),
|
||
|
address, output, size;
|
||
|
|
||
|
if (phantom.args.length < 2) {
|
||
|
console.log('Usage: rasterize.js URL filename');
|
||
|
phantom.exit();
|
||
|
} else {
|
||
|
address = phantom.args[0];
|
||
|
output = phantom.args[1];
|
||
|
|
||
|
page.viewportSize = { width: 1280, height: 1024 };
|
||
|
|
||
|
page.open(address, function (status) {
|
||
|
if (status !== 'success') {
|
||
|
console.log('Unable to load the address!');
|
||
|
} else {
|
||
|
window.setTimeout(function () {
|
||
|
page.render(output);
|
||
|
phantom.exit();
|
||
|
}, 500);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|