ncb000gt/node-gs — pull request #4 by ecarter (2012-12-06 03:47:36+00:00)
Title: Support for single page and page range processing

Adds support for processing a specific page or range of pages to the api.

---

**#page(number)** - process a single page

```
gs()
.nopause()
.input('./tests/pdfs/sizes.pdf')
.output('./test/pdfs/sizes-%d.jpg')
.page(2)
.on('page', function(page){
console.log('page %s processed', page); // page 2 processed
})
.exec(function(err, data){
// do stuff...
});
```

**#pages(from, to)** - process a page range

```
gs()
.nopause()
.input('./tests/pdfs/sizes.pdf')
.output('./test/pdfs/sizes-%d.jpg')
.pages(2, 3)
.on('pages', function(from, to){
console.log('processing pages %s-%s', from, to); // processing pages 2-3
})
.exec(function(err, data){
// do stuff...
});
```

Both `.page()` and `.pages()` are basically just shortcuts for `gs` definitions. Using the `.define()` api it would looks something like this:

```
gs()
.define('FirstPage', page)
.define('LastPage', page)
```

_Tests included_

---

@ncb000gt let me know what you think. I'll merge and close this PR if it looks good by you :beers: