An internal PDF::Reader class that represents a stream object from a PDF. Stream objects have 2 components, a dictionary that describes the content (size, compression, etc) and a stream of bytes.
Creates a new stream with the specified dictionary and data. The dictionary should be a standard ruby hash, the data should be a standard ruby string.
# File lib/pdf/reader/stream.rb, line 38 def initialize (hash, data) @hash = hash @data = data @udata = nil end
apply this streams filters to its data and return the result.
# File lib/pdf/reader/stream.rb, line 45 def unfiltered_data return @udata if @udata @udata = data.dup if hash.has_key?(:Filter) options = [] if hash.has_key?(:DecodeParms) if hash[:DecodeParms].is_a?(Hash) options = [hash[:DecodeParms]] else options = hash[:DecodeParms] end end Array(hash[:Filter]).each_with_index do |filter, index| @udata = Filter.with(filter, options[index]).filter(@udata) end end @udata end