class PDF::Reader::Filter
in the future.
Currently only 1 filter type is supported. Hopefully support for others will be added
content.
support for features like compression and encryption. This class is for decoding that
Various parts of a PDF file can be passed through a filter before being stored to provide
###############################################################################
def filter (data)
###############################################################################
def filter (data) # leave the data untouched if we don't support the required filter return data if @filter.nil? # decode the data self.send(@filter, data) end
def flate (data)
###############################################################################
def flate (data) begin z = Zlib::Inflate.new z.inflate(data) rescue Exception => e raise MalformedPDFError, "Error occured while inflating a compressed stream (#{e.class.to_s}: #{e.to_s})" end end
def initialize (name, options)
###############################################################################
def initialize (name, options) @options = options case name when "FlateDecode" then @filter = :flate #else raise UnsupportedFeatureError, "Unknown filter: #{name}" end end