forked from exciting-io/printer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrasterise.js
More file actions
26 lines (25 loc) · 734 Bytes
/
Copy pathrasterise.js
File metadata and controls
26 lines (25 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var page = new WebPage(),
address, output, size;
if (phantom.args.length < 2 || phantom.args.length > 3) {
console.log('Usage: rasterize.js URL width filename');
phantom.exit();
} else {
address = phantom.args[0];
width = phantom.args[1];
output = phantom.args[2];
page.viewportSize = { width: width, height: 10 };
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address "' + address + '"');
phantom.exit(1);
} else {
page.evaluate(function() {
document.getElementsByTagName("body")[0].className = ""
});
window.setTimeout(function () {
page.render(output);
phantom.exit();
}, 200);
}
});
}