Skip to content

Instantly share code, notes, and snippets.

@shawjia
Created December 4, 2012 06:35
Show Gist options
  • Select an option

  • Save shawjia/4201297 to your computer and use it in GitHub Desktop.

Select an option

Save shawjia/4201297 to your computer and use it in GitHub Desktop.
simple script to save web page as a png file
###
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