Class: Rpdf2txt::InlineImage

Inherits:
Image show all
Defined in:
lib/rpdf2txt/object.rb

Constant Summary collapse

ATTR_ABBREVIATIONS =
{
  :bpc => :bitspercomponent, :cs => :colorspace,
  :d   => :decode,           :dp => :decodeparms,
  :f   => :filter,           :h  => :height,
  :im  => :imagemask,        :i  => :interpolate,
  :w   => :width,
}
OTHER_ABBREVIATIONS =
{
  '/G'    => '/DeviceGray',
  '/RGB'  => '/DeviceRGB',
  '/CMYK' => '/DeviceCMYK',
  '/I'    => '/Indexed',
  '/AHx'  => '/ASCIIHexDecode',
  '/A85'  => '/ASCII85Decode',
  '/LZW'  => '/LZWDecode',
  '/Fl'   => '/FlateDecode',
  '/RL'   => '/RunLengthDecode',
  '/CCF'  => '/CCITTFaxDecode',
  '/DCT'  => '/DCTDecode',
}

Constants inherited from Image

Rpdf2txt::Image::COLORMAPS

Constants inherited from Stream

Stream::BT_PATTERN, Stream::ET_PATTERN, Stream::FAIL_PTRN

Instance Attribute Summary

Attributes inherited from PdfObject

#attributes, #decoder, #oid, #src

Instance Method Summary collapse

Methods inherited from Image

#idat_decode, #image

Methods inherited from Stream

#append, #decode_raw_stream, #decoded_stream, #decoded_stream=, #extract_horizontal_rules, #extract_nontext_objects, #extract_text_objects, #flate_decode, #lzw_decode, #raw_stream, #to_cmap

Methods inherited from PdfObject

#_parse_attributes, #build_tree, #catalogue_object, #decoded_stream, #extract_attribute_stream, #revision_id

Constructor Details

#initialize(attrs, data) ⇒ InlineImage

Returns a new instance of InlineImage.



1017
1018
1019
1020
# File 'lib/rpdf2txt/object.rb', line 1017

def initialize(attrs, data)
  super("<<" << attrs << ">>")
  @raw_stream = data
end

Instance Method Details

#parse_attributesObject



1021
1022
1023
1024
1025
1026
1027
1028
# File 'lib/rpdf2txt/object.rb', line 1021

def parse_attributes
  super
  ATTR_ABBREVIATIONS.each do |abbr, key|
    if value = @attributes.delete(abbr)
      @attributes.store key, OTHER_ABBREVIATIONS.fetch(value, value)
    end
  end
end