documentation
[mkws-moved-to-github.git] / test / spec-dev / screenshot.js
1 var page = require('webpage').create(),
2     system = require('system');
3
4 var url = system.args[1] || 'http://www.indexdata.com/';
5 var file_png = system.args[2] || 'indexdata.png';
6
7 if (system.args.length === 1) {
8     console.log('Usage: screenshot.js <some URL> <file.png>');
9     phantom.exit();
10 }
11
12 // page.paperSize = { format: 'A4', orientation: "landscape" };
13 // page.zoomFactor = 1.0;
14 page.viewportSize = {
15     width: 1200,
16     height: 1000
17 };
18
19 page.open(url, function () {
20     // small delay
21     setTimeout(function () {
22         page.render(file_png);
23         console.log(page);
24         phantom.exit();
25     }, 500);
26 });