Skip to content

Instantly share code, notes, and snippets.

@netsi1964
Created February 19, 2016 22:38
Show Gist options
  • Save netsi1964/8a90640d656262f6c636 to your computer and use it in GitHub Desktop.
Save netsi1964/8a90640d656262f6c636 to your computer and use it in GitHub Desktop.
Simple screenshoot script for PhantomJS
var page = require('webpage').create();
//viewportSize being the actual size of the headless browser
page.viewportSize = { width: 1024, height: 768 };
//the clipRect is the portion of the page you are taking a screenshot of
page.clipRect = { top: 0, left: 0, width: 1024, height: 768 };
//the rest of the code is the same as the previous example
page.open('http://www.netsi.dk/wordpress', function() {
page.render('netsi.png');
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment