Class: EideticPDF::PdfObjects::PdfStream

Inherits:
PdfDictionaryObject show all
Defined in:
lib/epdfo.rb

Direct Known Subclasses

PdfXObject

Instance Attribute Summary collapse

Attributes inherited from IndirectObject

#gen, #seq

Instance Method Summary collapse

Methods inherited from PdfDictionaryObject

#dictionary

Methods inherited from IndirectObject

#footer, #header, #reference_object, #reference_string, #to_s

Constructor Details

#initialize(seq, gen, stream = nil) ⇒ PdfStream

Returns a new instance of PdfStream.



324
325
326
327
328
# File 'lib/epdfo.rb', line 324

def initialize(seq, gen, stream=nil)
  super(seq, gen)
  @stream = (stream || '').dup
  dictionary['Length'] = PdfInteger.new(length)
end

Instance Attribute Details

#streamObject (readonly)

Returns the value of attribute stream.



322
323
324
# File 'lib/epdfo.rb', line 322

def stream
  @stream
end

Instance Method Details

#bodyObject



342
343
344
345
# File 'lib/epdfo.rb', line 342

def body
  dictionary['Length'] = PdfInteger.new(length)
  "#{super}stream\n#{stream}endstream\n"
end

#filter=(filter) ⇒ Object



334
335
336
337
338
339
340
# File 'lib/epdfo.rb', line 334

def filter=(filter)
  if filter.is_a?(PdfArray)
    dictionary['Filter'] = filter
  else
    dictionary['Filter'] = PdfName.new(filter)
  end
end

#lengthObject



330
331
332
# File 'lib/epdfo.rb', line 330

def length
  stream.length
end