devongovett/pdfkit — pull request #302 by ef4 (2014-09-11 21:50:57+00:00)
Title: Optional page buffering

This closes #225 by adding an optional page buffer. The API works as follows:

1. Pass the option `bufferPages: true` when creating your document.
2. Call `doc.bufferedPageCount()` at any time to ask how many pages are buffered.
3. Call `doc.switchToPage(n)` to make any of the buffered pages the current page again. This lets you add additional content.
4. Call `doc.flushPages()` to flush the page buffer out to the underlying stream. This is optional, it also happens automatically at `end()`.