     @transform 1, 0, 0, -1, 0, @page.height
     
     return this
-    
+
+  bufferedPageRange: -> { start: @_pageBufferStart, count: @_pageBuffer.length }
+
+  switchToPage: (n) ->
+    unless page = @_pageBuffer[n-@_pageBufferStart]
+      throw new Error("switchToPage(#{n}) out of bounds, current buffer covers pages #{@_pageBufferStart} to #{@_pageBufferStart + @_pageBuffer.length - 1}")
+    @page = page
+
+  flushPages: ->
+    # this local variable exists so we're future-proof against
+    # reentrant calls to flushPages.
+    pages = @_pageBuffer
+    @_pageBuffer = []
+    @_pageBufferStart += pages.length
+    for page in pages
+      page.end()
+    null
+
   ref: (data) ->
     ref = new PDFReference(this, @_offsets.length + 1, data)
     @_offsets.push null # placeholder for this object's offset once it is finalized

    
  addPage: (options = @options) ->
    # end the current page if needed
    @page?.end()
    
    # create a page object
    @page = new PDFPage(this, options)
    
    # add the page to the object store
    pages = @_root.data.Pages.data
    pages.Kids.push @page.dictionary

    # Whether streams should be compressed
    @compress = @options.compress ? yes
    
    @_pageBuffer = []
    @_pageBufferStart = 0

    # The PDF object store
    @_offsets = []
    @_waiting = 0
