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

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

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