     else
       @chunks.push chunk
       @data.Length += chunk.length
+      
+    callback()
     
   end: (chunk) ->
-    if typeof chunk is 'string' or Buffer.isBuffer(chunk)
-      @write chunk
+    super
     
     if @deflate
       @deflate.end()

      @data.Length += chunk.length
      
    @deflate.on 'end', @finalize
  
  write: (chunk) ->
    unless Buffer.isBuffer(chunk)
      chunk = new Buffer(chunk + '\n', 'binary')
      

###

zlib = require 'zlib'
stream = require 'stream'

class PDFReference extends stream.Writable
  constructor: (@document, @id, @data = {}) ->
    super decodeStrings: no
    @gen = 0
    @deflate = null
    @compress = @document.compress and not @data.Filter
