Skip to content

Instantly share code, notes, and snippets.

@splio-aleroux
Created June 27, 2014 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splio-aleroux/f3e7aaedaa279d084a00 to your computer and use it in GitHub Desktop.
Save splio-aleroux/f3e7aaedaa279d084a00 to your computer and use it in GitHub Desktop.
page.open(address, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit();
} else {
page.evaluate(function() {
document.body.bgColor = 'white';
});
var arr = page.evaluate(function () {
var pageWidth = document.body.clientWidth;
var pageHeight = document.body.clientHeight;
return [pageWidth, pageHeight];
});
page.viewportSize = { width: arr[0], height: arr[1] };
page.render(output);
phantom.exit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment