Last active
December 20, 2015 03:09
-
-
Save dehora/6061943 to your computer and use it in GitHub Desktop.
clip a page using phantomjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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