Created
September 27, 2016 23:24
-
-
Save quanon/95e71c6a296e274d1760c8c8cd706bf1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var page = require('webpage').create(); | |
var args = require('system').args; | |
page.viewportSize = { | |
width: 1200, | |
height: 780 | |
}; | |
page.open(args[1], function (status) { | |
if (status !== 'success') { | |
console.log('Unable to load the address!'); | |
} else { | |
var clipRect = page.evaluate(function () { | |
return document.querySelector('body').getBoundingClientRect(); | |
}); | |
page.clipRect = { | |
top: clipRect.top, | |
left: clipRect.left, | |
width: clipRect.width, | |
height: clipRect.height | |
}; | |
window.setTimeout(function () { | |
page.render('capture.png'); | |
phantom.exit(); | |
}, 5000); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment