Method: Aspose::Cloud::Words::Extractor#convert_drawing_object

Defined in:
lib/Words/extractor.rb

#convert_drawing_object(index, render_format) ⇒ Object

Convert drawing object to image

@param number index
@param string render_format


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/Words/extractor.rb', line 135

def convert_drawing_object 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