Skip to content

Instantly share code, notes, and snippets.

@charliepark
Created June 5, 2014 00:29
Show Gist options
  • Save charliepark/b42819ebac284df670b0 to your computer and use it in GitHub Desktop.
Save charliepark/b42819ebac284df670b0 to your computer and use it in GitHub Desktop.
A demo Phantom.js script
var width = 320;
var height = 480;
var webpage = require('webpage');
page = webpage.create();
page.viewportSize = {width: width, height: height};
page.open('https://ifttt.com', function(status) {
console.log(status);
page.evaluate(function(w, h) {
document.body.style.width = w + "px";
document.body.style.height = h + "px";
}, width, height);
page.clipRect = {top: 0, left: 0, width: width, height: height};
page.render('example.png');
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment