Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Last active December 18, 2015 13:29
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 gabrielflorit/5790387 to your computer and use it in GitHub Desktop.
Save gabrielflorit/5790387 to your computer and use it in GitHub Desktop.
custom version of rasterize.js
var page = require('webpage').create(),
system = require('system'),
address, output, size;
var width = 1024;
var height = 768;
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