brenden/node-webshot — pull request #19 by mcwhittemore (2013-05-19 04:05:28+00:00)
Title: Adding HTML support

I have added in functionality that allows webshot to take screenshots of unhosted html.

This change required the addition of an option config and a small restructuring of the webshot.phantom.js file.

The addition to the option config has been called `siteType` as it ids the type of string passed to `site` (the first argument of webshot). `siteType` defaults to `url` so that this release will be non-breaking and is limited to `url` and `html`.

The restructure of webshot.phantom.js moves code called by phantom's `onLoadFinished` trigger to `whenLoadFinished` and moves the webpage action commands to an if block near the bottom.

Here is an example of how this works.

```
var options = {siteType: 'html'};
webshot('

Hello World

', './hello_world.png', options, function(err) {
console.log("TAKE A LOOK IN HELLO_WORLD.png");
});
```

I have had to do this development on Heroku as phantomjs is having installation problems with my computer. This means I have committed more frequently than I would normal and that the provided tests are untested. It also means that there is a [functioning example here](http://radiant-crag-1190.herokuapp.com) with the [url image displaying here](http://radiant-crag-1190.herokuapp.com/url.png) and the [html image residing here](http://radiant-crag-1190.herokuapp.com/html.png).

Thanks for considering this pull request and please hit me up with any needed changes.