Skip to content

Instantly share code, notes, and snippets.

@sputnick-dev
Created April 3, 2016 19:51
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 sputnick-dev/5daa57dc6055f723f9fd7e56e34285e2 to your computer and use it in GitHub Desktop.
Save sputnick-dev/5daa57dc6055f723f9fd7e56e34285e2 to your computer and use it in GitHub Desktop.
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://phantomjs.org/screen-capture.html', function() {
page.render('capture.png');
console.log('Check capture.png');
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment