Skip to content

Instantly share code, notes, and snippets.

@campeterson
Forked from javan/screenshot.js
Created November 5, 2012 17:18
Show Gist options
  • Save campeterson/4018418 to your computer and use it in GitHub Desktop.
Save campeterson/4018418 to your computer and use it in GitHub Desktop.
Create a screenshot of any URL using phantomjs (headless webkit)
//
// Example usage: phantomjs screenshot.js http://yahoo.com /tmp/yahoo.png
//
var system = require('system');
var url = system.args[1];
var filename = system.args[2];
var page = new WebPage();
page.open(url, function (status) {
page.viewportSize = { width: 2000, height: 600 };
page.render(filename);
console.log(filename)
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment