Method: Aspose::Cloud::Words::Extractor#get_image_data

Defined in:
lib/Words/extractor.rb

#get_image_data(index, render_format) ⇒ Object

Get the Image drawing object from document

@param number index
@param string render_format


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/Words/extractor.rb', line 91

def get_image_data index, render_format
      
  begin

    if @filename == ''
      raise 'Base file not specified.'
    end

    if index == ''
      raise 'Index not specified.'
    end

    if render_format == ''
      raise 'Render Format not specified.'
    end

    str_uri = $product_uri + '/words/' + @filename + '/drawingObjects/' + index.to_s + '/imagedata'
    signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

    response_stream = RestClient.get(signed_str_uri,{:accept=>'application/json'})

    valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)

    if valid_output == ''                    
  
      output_path = $out_put_location + Aspose::Cloud::Common::Utils.get_filename(@filename) + '_' + index.to_s + '.' + render_format
      Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
      return output_path
    else
      return valid_output
    end

  rescue Exception=>e
    print e
  end
      
end