Class: AsposeWordsCloud::SaveAsTiffOnlineRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb

Overview

Request model for save_as_tiff_online operation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document:, save_options:, load_encoding: nil, password: nil, encrypted_password: nil, use_anti_aliasing: nil, use_high_quality_rendering: nil, image_brightness: nil, image_color_mode: nil, image_contrast: nil, numeral_format: nil, page_count: nil, page_index: nil, paper_color: nil, pixel_format: nil, resolution: nil, scale: nil, tiff_compression: nil, dml_rendering_mode: nil, dml_effects_rendering_mode: nil, tiff_binarization_method: nil, zip_output: nil, fonts_location: nil) ⇒ SaveAsTiffOnlineRequest

Initializes a new instance.

Parameters:

  • document

    The document.

  • save_options

    Tiff save options.

  • load_encoding (defaults to: nil)

    Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.

  • password (defaults to: nil)

    Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don’t recommend to use the parameter to pass a plain password for direct call of API.

  • encrypted_password (defaults to: nil)

    Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.

  • use_anti_aliasing (defaults to: nil)

    The flag indicating whether to use antialiasing.

  • use_high_quality_rendering (defaults to: nil)

    The flag indicating whether to use high quality.

  • image_brightness (defaults to: nil)

    The level of brightness for the generated images.

  • image_color_mode (defaults to: nil)

    The color mode for the generated images.

  • image_contrast (defaults to: nil)

    The contrast for the generated images.

  • numeral_format (defaults to: nil)

    The images numeral format.

  • page_count (defaults to: nil)

    The number of pages to render.

  • page_index (defaults to: nil)

    The index of the page to start rendering.

  • paper_color (defaults to: nil)

    The background image color.

  • pixel_format (defaults to: nil)

    The pixel format of the generated images.

  • resolution (defaults to: nil)

    The resolution of the generated images.

  • scale (defaults to: nil)

    The zoom factor for the generated images.

  • tiff_compression (defaults to: nil)

    The compression tipe.

  • dml_rendering_mode (defaults to: nil)

    The optional dml rendering mode. The default value is Fallback.

  • dml_effects_rendering_mode (defaults to: nil)

    The optional dml effects rendering mode. The default value is Simplified.

  • tiff_binarization_method (defaults to: nil)

    The optional TIFF binarization method. Possible values are: FloydSteinbergDithering, Threshold.

  • zip_output (defaults to: nil)

    The flag indicating whether to ZIP the output.

  • fonts_location (defaults to: nil)

    Folder in filestorage with custom fonts.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 127

def initialize(document:, save_options:, load_encoding: nil, password: nil, encrypted_password: nil, use_anti_aliasing: nil, use_high_quality_rendering: nil, image_brightness: nil, image_color_mode: nil, image_contrast: nil, numeral_format: nil, page_count: nil, page_index: nil, paper_color: nil, pixel_format: nil, resolution: nil, scale: nil, tiff_compression: nil, dml_rendering_mode: nil, dml_effects_rendering_mode: nil, tiff_binarization_method: nil, zip_output: nil, fonts_location: nil)
  self.document = document
  self.save_options = save_options
  self.load_encoding = load_encoding
  self.password = password
  self.encrypted_password = encrypted_password
  self.use_anti_aliasing = use_anti_aliasing
  self.use_high_quality_rendering = use_high_quality_rendering
  self.image_brightness = image_brightness
  self.image_color_mode = image_color_mode
  self.image_contrast = image_contrast
  self.numeral_format = numeral_format
  self.page_count = page_count
  self.page_index = page_index
  self.paper_color = paper_color
  self.pixel_format = pixel_format
  self.resolution = resolution
  self.scale = scale
  self.tiff_compression = tiff_compression
  self.dml_rendering_mode = dml_rendering_mode
  self.dml_effects_rendering_mode = dml_effects_rendering_mode
  self.tiff_binarization_method = tiff_binarization_method
  self.zip_output = zip_output
  self.fonts_location = fonts_location
end

Instance Attribute Details

#dml_effects_rendering_modeObject

The optional dml effects rendering mode. The default value is Simplified.



90
91
92
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 90

def dml_effects_rendering_mode
  @dml_effects_rendering_mode
end

#dml_rendering_modeObject

The optional dml rendering mode. The default value is Fallback.



87
88
89
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 87

def dml_rendering_mode
  @dml_rendering_mode
end

#documentObject

The document.



33
34
35
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 33

def document
  @document
end

#encrypted_passwordObject

Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.



45
46
47
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 45

def encrypted_password
  @encrypted_password
end

#fonts_locationObject

Folder in filestorage with custom fonts.



99
100
101
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 99

def fonts_location
  @fonts_location
end

#image_brightnessObject

The level of brightness for the generated images.



54
55
56
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 54

def image_brightness
  @image_brightness
end

#image_color_modeObject

The color mode for the generated images.



57
58
59
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 57

def image_color_mode
  @image_color_mode
end

#image_contrastObject

The contrast for the generated images.



60
61
62
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 60

def image_contrast
  @image_contrast
end

#load_encodingObject

Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.



39
40
41
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 39

def load_encoding
  @load_encoding
end

#numeral_formatObject

The images numeral format.



63
64
65
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 63

def numeral_format
  @numeral_format
end

#page_countObject

The number of pages to render.



66
67
68
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 66

def page_count
  @page_count
end

#page_indexObject

The index of the page to start rendering.



69
70
71
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 69

def page_index
  @page_index
end

#paper_colorObject

The background image color.



72
73
74
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 72

def paper_color
  @paper_color
end

#passwordObject

Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don’t recommend to use the parameter to pass a plain password for direct call of API.



42
43
44
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 42

def password
  @password
end

#pixel_formatObject

The pixel format of the generated images.



75
76
77
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 75

def pixel_format
  @pixel_format
end

#resolutionObject

The resolution of the generated images.



78
79
80
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 78

def resolution
  @resolution
end

#save_optionsObject

Tiff save options.



36
37
38
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 36

def save_options
  @save_options
end

#scaleObject

The zoom factor for the generated images.



81
82
83
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 81

def scale
  @scale
end

#tiff_binarization_methodObject

The optional TIFF binarization method. Possible values are: FloydSteinbergDithering, Threshold.



93
94
95
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 93

def tiff_binarization_method
  @tiff_binarization_method
end

#tiff_compressionObject

The compression tipe.



84
85
86
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 84

def tiff_compression
  @tiff_compression
end

#use_anti_aliasingObject

The flag indicating whether to use antialiasing.



48
49
50
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 48

def use_anti_aliasing
  @use_anti_aliasing
end

#use_high_quality_renderingObject

The flag indicating whether to use high quality.



51
52
53
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 51

def use_high_quality_rendering
  @use_high_quality_rendering
end

#zip_outputObject

The flag indicating whether to ZIP the output.



96
97
98
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 96

def zip_output
  @zip_output
end

Instance Method Details

#create_http_request(api_client) ⇒ Object

Raises:

  • (ArgumentError)


242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 242

def create_http_request(api_client)
  # verify the required parameter 'document' is set
  raise ArgumentError, 'Missing the required parameter document when calling WordsApi.save_as_tiff_online' if api_client.config.client_side_validation && self.document.nil?
  # verify the required parameter 'save_options' is set
  raise ArgumentError, 'Missing the required parameter save_options when calling WordsApi.save_as_tiff_online' if api_client.config.client_side_validation && self.save_options.nil?
  self.save_options.validate
  # resource path
  local_var_path = '/words/online/put/saveAs/tiff'[1..-1]
  local_var_path = local_var_path.sub('//', '/')

  # query parameters
  query_params = {}
  query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
  query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
  query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
  query_params[downcase_first_letter('UseAntiAliasing')] = self.use_anti_aliasing unless self.use_anti_aliasing.nil?
  query_params[downcase_first_letter('UseHighQualityRendering')] = self.use_high_quality_rendering unless self.use_high_quality_rendering.nil?
  query_params[downcase_first_letter('ImageBrightness')] = self.image_brightness unless self.image_brightness.nil?
  query_params[downcase_first_letter('ImageColorMode')] = self.image_color_mode unless self.image_color_mode.nil?
  query_params[downcase_first_letter('ImageContrast')] = self.image_contrast unless self.image_contrast.nil?
  query_params[downcase_first_letter('NumeralFormat')] = self.numeral_format unless self.numeral_format.nil?
  query_params[downcase_first_letter('PageCount')] = self.page_count unless self.page_count.nil?
  query_params[downcase_first_letter('PageIndex')] = self.page_index unless self.page_index.nil?
  query_params[downcase_first_letter('PaperColor')] = self.paper_color unless self.paper_color.nil?
  query_params[downcase_first_letter('PixelFormat')] = self.pixel_format unless self.pixel_format.nil?
  query_params[downcase_first_letter('Resolution')] = self.resolution unless self.resolution.nil?
  query_params[downcase_first_letter('Scale')] = self.scale unless self.scale.nil?
  query_params[downcase_first_letter('TiffCompression')] = self.tiff_compression unless self.tiff_compression.nil?
  query_params[downcase_first_letter('DmlRenderingMode')] = self.dml_rendering_mode unless self.dml_rendering_mode.nil?
  query_params[downcase_first_letter('DmlEffectsRenderingMode')] = self.dml_effects_rendering_mode unless self.dml_effects_rendering_mode.nil?
  query_params[downcase_first_letter('TiffBinarizationMethod')] = self.tiff_binarization_method unless self.tiff_binarization_method.nil?
  query_params[downcase_first_letter('ZipOutput')] = self.zip_output unless self.zip_output.nil?
  query_params[downcase_first_letter('FontsLocation')] = self.fonts_location unless self.fonts_location.nil?

  # header parameters
  header_params = {}
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = []
  files_content = []
  if self.document.nil?
    raise "Parameter Document is required."
  end
  unless self.document.nil?
    form_params.push({:'Name' => 'document', :'Data' => self.document, :'MimeType' =>'application/octet-stream'})
  end

  if self.save_options.nil?
    raise "Parameter SaveOptions is required."
  end
  unless self.save_options.nil?
    form_params.push({:'Name' => 'saveOptions', :'Data' => self.save_options.to_body.to_json, :'MimeType' =>'application/json'})
  end

  body = api_client.build_request_body(header_params, form_params, files_content)
  {
    'method': :PUT,
    'path': local_var_path,
    'header_params': header_params,
    'query_params': query_params,
    'body': body,
    'auth_names': ['JWT']
  }
end

#downcase_first_letter(str) ⇒ Object

Helper method to convert first letter to downcase



312
313
314
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 312

def downcase_first_letter(str)
  str[0].downcase + str[1..-1]
end

#get_response_typeObject

Get response type



317
318
319
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 317

def get_response_type
  'SaveAsTiffOnlineResponse'
end

#to_batch_part(api_client, requestId, parentRequestId = nil) ⇒ Object

Creating batch part from request

Raises:

  • (ArgumentError)


154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/aspose_words_cloud/models/requests/save_as_tiff_online_request.rb', line 154

def to_batch_part(api_client, requestId, parentRequestId = nil)
  # verify the required parameter 'document' is set
  raise ArgumentError, 'Missing the required parameter document when calling WordsApi.save_as_tiff_online' if api_client.config.client_side_validation && self.document.nil?
  # verify the required parameter 'save_options' is set
  raise ArgumentError, 'Missing the required parameter save_options when calling WordsApi.save_as_tiff_online' if api_client.config.client_side_validation && self.save_options.nil?
  self.save_options.validate
  # resource path
  local_var_path = '/words/online/put/saveAs/tiff'[7..-1]
  local_var_path = local_var_path.sub('//', '/')

  # query parameters
  query_params = {}
  query_params[downcase_first_letter('LoadEncoding')] = self.load_encoding unless self.load_encoding.nil?
  query_params[downcase_first_letter('Password')] = self.password unless self.password.nil?
  query_params[downcase_first_letter('EncryptedPassword')] = self.encrypted_password unless self.encrypted_password.nil?
  query_params[downcase_first_letter('UseAntiAliasing')] = self.use_anti_aliasing unless self.use_anti_aliasing.nil?
  query_params[downcase_first_letter('UseHighQualityRendering')] = self.use_high_quality_rendering unless self.use_high_quality_rendering.nil?
  query_params[downcase_first_letter('ImageBrightness')] = self.image_brightness unless self.image_brightness.nil?
  query_params[downcase_first_letter('ImageColorMode')] = self.image_color_mode unless self.image_color_mode.nil?
  query_params[downcase_first_letter('ImageContrast')] = self.image_contrast unless self.image_contrast.nil?
  query_params[downcase_first_letter('NumeralFormat')] = self.numeral_format unless self.numeral_format.nil?
  query_params[downcase_first_letter('PageCount')] = self.page_count unless self.page_count.nil?
  query_params[downcase_first_letter('PageIndex')] = self.page_index unless self.page_index.nil?
  query_params[downcase_first_letter('PaperColor')] = self.paper_color unless self.paper_color.nil?
  query_params[downcase_first_letter('PixelFormat')] = self.pixel_format unless self.pixel_format.nil?
  query_params[downcase_first_letter('Resolution')] = self.resolution unless self.resolution.nil?
  query_params[downcase_first_letter('Scale')] = self.scale unless self.scale.nil?
  query_params[downcase_first_letter('TiffCompression')] = self.tiff_compression unless self.tiff_compression.nil?
  query_params[downcase_first_letter('DmlRenderingMode')] = self.dml_rendering_mode unless self.dml_rendering_mode.nil?
  query_params[downcase_first_letter('DmlEffectsRenderingMode')] = self.dml_effects_rendering_mode unless self.dml_effects_rendering_mode.nil?
  query_params[downcase_first_letter('TiffBinarizationMethod')] = self.tiff_binarization_method unless self.tiff_binarization_method.nil?
  query_params[downcase_first_letter('ZipOutput')] = self.zip_output unless self.zip_output.nil?
  query_params[downcase_first_letter('FontsLocation')] = self.fonts_location unless self.fonts_location.nil?

  if query_params
    query_params.each { |key, value| local_var_path = api_client.add_param_to_query(local_var_path, key, value) }
  end

  header_params = {}
  # header parameters
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = api_client.select_header_content_type(['multipart/form-data'])
  header_params['RequestId'] = requestId

  if parentRequestId != nil
    header_params['DependsOn'] = parentRequestId
  end

  # form parameters
  form_params = []
  files_content = []
  if self.document.nil?
    raise "Parameter Document is required."
  end
  unless self.document.nil?
    form_params.push({:'Name' => 'document', :'Data' => self.document, :'MimeType' =>'application/octet-stream'})
  end

  if self.save_options.nil?
    raise "Parameter SaveOptions is required."
  end
  unless self.save_options.nil?
    form_params.push({:'Name' => 'saveOptions', :'Data' => self.save_options.to_body.to_json, :'MimeType' =>'application/json'})
  end


  # http body (model)
  body = api_client.build_request_body_batch(header_params, form_params, files_content)
  part = ""
  part.concat("PUT".force_encoding('UTF-8'))
  part.concat(" ".force_encoding('UTF-8'))
  part.concat(local_var_path.force_encoding('UTF-8'))
  part.concat(" \r\n".force_encoding('UTF-8'))

  header_params.each_pair {|key, value| part.concat(key.dup.force_encoding('UTF-8') , ": ".force_encoding('UTF-8'), value.dup.force_encoding('UTF-8'), "\r\n".force_encoding('UTF-8')) }
  part.concat("\r\n".force_encoding('UTF-8'))
  if body
    if body.is_a?(Hash)
      body.each do |key, value|
        part.concat(value, "\r\n")
      end
    else
      part.concat(body)
    end
  end
 part
end