Module: PDF::Impose::Ext::Reference

Defined in:
lib/pdf/impose/ext.rb

Instance Method Summary collapse

Instance Method Details

#extract_content_streamObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pdf/impose/ext.rb', line 5

def extract_content_stream
  content = stream
  content = content.filtered_stream if content.respond_to?(:filtered_stream)

  if data[:Filter]
    options = []

    if data[:DecodeParams].is_a?(Hash)
      options = [data[:DecodeParams]]
    elsif data[:DecodeParams]
      options = data[:DecodeParams]
    end

    Array(data[:Filter]).each_with_index do |filter, index|
      content = PDF::Reader::Filter.
                with(filter, options[index]).filter(content)
    end
  end

  content
end