Created
December 4, 2012 06:35
-
-
Save shawjia/4201297 to your computer and use it in GitHub Desktop.
simple script to save web page as a png file
This file contains hidden or 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
| ### | |
| simple script to save web page as a png file | |
| example: | |
| phantomjs web_snapshot.coffee http://m.wikipedia.org/wiki/Special:Random | |
| ### | |
| page = require('webpage').create() | |
| system = require 'system' | |
| if system.args.length is 1 | |
| console.log 'please give me some url' | |
| phantom.exit() | |
| else | |
| page.open system.args[1], -> | |
| page.render "#{+ new Date()}.png" | |
| phantom.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment