Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Created July 17, 2013 17:06
Show Gist options
  • Save gabrielflorit/6022462 to your computer and use it in GitHub Desktop.
Save gabrielflorit/6022462 to your computer and use it in GitHub Desktop.
rasterize 1920x1200
var page = require('webpage').create(),
system = require('system'),
address, output, size;
var width = 1920;
var height = 1200;
address = system.args[1];
output = system.args[2];
page.viewportSize = { width: width, height: height };
page.clipRect = { width: width, height: height };
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';
});
window.setTimeout(function () {
page.render(output);
phantom.exit();
}, 200);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment