Skip to content

Instantly share code, notes, and snippets.

@dehora
Last active December 20, 2015 03:09
Show Gist options
  • Save dehora/6061943 to your computer and use it in GitHub Desktop.
Save dehora/6061943 to your computer and use it in GitHub Desktop.
clip a page using phantomjs
var page = require('webpage').create();
var system = require('system');
if (system.args.length === 1) {
console.log('Usage: clip.js <url>');
phantom.exit(1);
} else {
address = system.args[1];
page.open(address, function () {
var title = page.evaluate(function () {
return document.title;
});
page.clipRect = { top: 130, left: 0, width: 900, height: 700 };
page.render(title + ".png");
phantom.exit();
});
}
#!/bin/sh
phantomjs clip.js https://cayova.com/user/dehora/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment