Class: GroupDocsViewerCloud::ImageOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_viewer_cloud/models/image_options.rb

Overview

Options for rendering document into image

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ImageOptions

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
241
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
308
309
310
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 188

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.key?(:'StartPageNumber')
    self.start_page_number = attributes[:'StartPageNumber']
  end

  if attributes.key?(:'CountPagesToRender')
    self.count_pages_to_render = attributes[:'CountPagesToRender']
  end

  if attributes.key?(:'PagesToRender')
    if (value = attributes[:'PagesToRender']).is_a?(Array)
      self.pages_to_render = value
    end
  end

  if attributes.key?(:'PageRotations')
    if (value = attributes[:'PageRotations']).is_a?(Array)
      self.page_rotations = value
    end
  end

  if attributes.key?(:'DefaultFontName')
    self.default_font_name = attributes[:'DefaultFontName']
  end

  if attributes.key?(:'DefaultEncoding')
    self.default_encoding = attributes[:'DefaultEncoding']
  end

  if attributes.key?(:'DetectEncoding')
    self.detect_encoding = attributes[:'DetectEncoding']
  end

  if attributes.key?(:'RenderComments')
    self.render_comments = attributes[:'RenderComments']
  end

  if attributes.key?(:'RenderNotes')
    self.render_notes = attributes[:'RenderNotes']
  end

  if attributes.key?(:'RenderHiddenPages')
    self.render_hidden_pages = attributes[:'RenderHiddenPages']
  end

  if attributes.key?(:'SpreadsheetOptions')
    self.spreadsheet_options = attributes[:'SpreadsheetOptions']
  end

  if attributes.key?(:'CadOptions')
    self.cad_options = attributes[:'CadOptions']
  end

  if attributes.key?(:'EmailOptions')
    self.email_options = attributes[:'EmailOptions']
  end

  if attributes.key?(:'ProjectManagementOptions')
    self.project_management_options = attributes[:'ProjectManagementOptions']
  end

  if attributes.key?(:'PdfDocumentOptions')
    self.pdf_document_options = attributes[:'PdfDocumentOptions']
  end

  if attributes.key?(:'WordProcessingOptions')
    self.word_processing_options = attributes[:'WordProcessingOptions']
  end

  if attributes.key?(:'OutlookOptions')
    self.outlook_options = attributes[:'OutlookOptions']
  end

  if attributes.key?(:'ArchiveOptions')
    self.archive_options = attributes[:'ArchiveOptions']
  end

  if attributes.key?(:'TextOptions')
    self.text_options = attributes[:'TextOptions']
  end

  if attributes.key?(:'MailStorageOptions')
    self.mail_storage_options = attributes[:'MailStorageOptions']
  end

  if attributes.key?(:'VisioRenderingOptions')
    self.visio_rendering_options = attributes[:'VisioRenderingOptions']
  end

  if attributes.key?(:'WebDocumentOptions')
    self.web_document_options = attributes[:'WebDocumentOptions']
  end

  if attributes.key?(:'Width')
    self.width = attributes[:'Width']
  end

  if attributes.key?(:'Height')
    self.height = attributes[:'Height']
  end

  if attributes.key?(:'ExtractText')
    self.extract_text = attributes[:'ExtractText']
  end

  if attributes.key?(:'JpegQuality')
    self.jpeg_quality = attributes[:'JpegQuality']
  end

  if attributes.key?(:'MaxWidth')
    self.max_width = attributes[:'MaxWidth']
  end

  if attributes.key?(:'MaxHeight')
    self.max_height = attributes[:'MaxHeight']
  end

end

Instance Attribute Details

#archive_optionsObject

Rendering options for Archive source file formats



86
87
88
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 86

def archive_options
  @archive_options
end

#cad_optionsObject

Rendering options for CAD source file formats CAD file formats include files with extensions: .dwg, .dxf, .dgn, .ifc, .stl



68
69
70
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 68

def cad_options
  @cad_options
end

#count_pages_to_renderObject

Count pages which should be rendered



38
39
40
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 38

def count_pages_to_render
  @count_pages_to_render
end

#default_encodingObject

Default encoding for the plain text files such as .csv, .txt and .eml files when encoding is not specified in header



50
51
52
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 50

def default_encoding
  @default_encoding
end

#default_font_nameObject

Default font name may be specified in following cases: - You want to generally specify the default font to fall back on, if particular font in the document cannot be found during rendering. - Your document uses fonts, that contain non-English characters and you want to make sure any missing font is replaced with one that has the same character set available.



47
48
49
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 47

def default_font_name
  @default_font_name
end

#detect_encodingObject

This option enables TXT, TSV, and CSV files encoding detection. In case the encoding can’t be detected the DefaultEncoding is used.



53
54
55
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 53

def detect_encoding
  @detect_encoding
end

#email_optionsObject

Rendering options for Email source file formats Email file formats include files with extensions: .msg, .eml, .emlx, .ifc, .stl



71
72
73
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 71

def email_options
  @email_options
end

#extract_textObject

When enabled Viewer will extract text when it’s possible (e.g. raster formats don’t have text layer) and return it in the viewing result. This option might be useful when you want to add selectable text layer over the image.



107
108
109
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 107

def extract_text
  @extract_text
end

#heightObject

Allows to specify output image height. Specify image height in case when you want to change output image dimensions. When Height has value and Width value is 0 then Width value will be calculated to save image proportions.



104
105
106
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 104

def height
  @height
end

#jpeg_qualityObject

Allows to specify quality when rendering as JPG. Valid values are between 1 and 100. Default value is 90.



110
111
112
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 110

def jpeg_quality
  @jpeg_quality
end

#mail_storage_optionsObject

Rendering options for Mail storage (Lotus Notes, MBox) data files.



92
93
94
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 92

def mail_storage_options
  @mail_storage_options
end

#max_heightObject

Max height of an output image in pixels



116
117
118
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 116

def max_height
  @max_height
end

#max_widthObject

Max width of an output image in pixels



113
114
115
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 113

def max_width
  @max_width
end

#outlook_optionsObject

Rendering options for Outlook source file formats



83
84
85
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 83

def outlook_options
  @outlook_options
end

#page_rotationsObject

Page rotations



44
45
46
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 44

def page_rotations
  @page_rotations
end

#pages_to_renderObject

Pages list to render. Ignored, if StartPageNumber and CountPagesToRender are provided



41
42
43
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 41

def pages_to_render
  @pages_to_render
end

#pdf_document_optionsObject

Rendering options for PDF source file formats



77
78
79
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 77

def pdf_document_options
  @pdf_document_options
end

#project_management_optionsObject

Rendering options for MS Project source file formats Project file formats include files with extensions: .mpt, .mpp



74
75
76
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 74

def project_management_options
  @project_management_options
end

#render_commentsObject

When enabled comments will be rendered to the output



56
57
58
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 56

def render_comments
  @render_comments
end

#render_hidden_pagesObject

When enabled hidden pages, sheets or slides will be rendered to the output



62
63
64
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 62

def render_hidden_pages
  @render_hidden_pages
end

#render_notesObject

When enabled notes will be rendered to the output



59
60
61
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 59

def render_notes
  @render_notes
end

#spreadsheet_optionsObject

Rendering options for Spreadsheet source file formats Spreadsheet file formats include files with extensions: .xls, .xlsx, .xlsm, .xlsb, .csv, .ods, .ots, .xltx, .xltm, .tsv



65
66
67
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 65

def spreadsheet_options
  @spreadsheet_options
end

#start_page_numberObject

Page number from which rendering should be started



35
36
37
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 35

def start_page_number
  @start_page_number
end

#text_optionsObject

Rendering options for Text source file formats



89
90
91
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 89

def text_options
  @text_options
end

#visio_rendering_optionsObject

Rendering options for Visio source file formats



95
96
97
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 95

def visio_rendering_options
  @visio_rendering_options
end

#web_document_optionsObject

This rendering options enables you to customize the appearance of the output HTML/PDF/PNG/JPEG when rendering Web documents.



98
99
100
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 98

def web_document_options
  @web_document_options
end

#widthObject

Allows to specify output image width. Specify image width in case when you want to change output image dimensions. When Width has value and Height value is 0 then Height value will be calculated to save image proportions.



101
102
103
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 101

def width
  @width
end

#word_processing_optionsObject

Rendering options for WordProcessing source file formats



80
81
82
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 80

def word_processing_options
  @word_processing_options
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 119

def self.attribute_map
  {
    :'start_page_number' => :'StartPageNumber',
    :'count_pages_to_render' => :'CountPagesToRender',
    :'pages_to_render' => :'PagesToRender',
    :'page_rotations' => :'PageRotations',
    :'default_font_name' => :'DefaultFontName',
    :'default_encoding' => :'DefaultEncoding',
    :'detect_encoding' => :'DetectEncoding',
    :'render_comments' => :'RenderComments',
    :'render_notes' => :'RenderNotes',
    :'render_hidden_pages' => :'RenderHiddenPages',
    :'spreadsheet_options' => :'SpreadsheetOptions',
    :'cad_options' => :'CadOptions',
    :'email_options' => :'EmailOptions',
    :'project_management_options' => :'ProjectManagementOptions',
    :'pdf_document_options' => :'PdfDocumentOptions',
    :'word_processing_options' => :'WordProcessingOptions',
    :'outlook_options' => :'OutlookOptions',
    :'archive_options' => :'ArchiveOptions',
    :'text_options' => :'TextOptions',
    :'mail_storage_options' => :'MailStorageOptions',
    :'visio_rendering_options' => :'VisioRenderingOptions',
    :'web_document_options' => :'WebDocumentOptions',
    :'width' => :'Width',
    :'height' => :'Height',
    :'extract_text' => :'ExtractText',
    :'jpeg_quality' => :'JpegQuality',
    :'max_width' => :'MaxWidth',
    :'max_height' => :'MaxHeight'
  }
end

.swagger_typesObject

Attribute type mapping.



153
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
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 153

def self.swagger_types
  {
    :'start_page_number' => :'Integer',
    :'count_pages_to_render' => :'Integer',
    :'pages_to_render' => :'Array<Integer>',
    :'page_rotations' => :'Array<PageRotation>',
    :'default_font_name' => :'String',
    :'default_encoding' => :'String',
    :'detect_encoding' => :'BOOLEAN',
    :'render_comments' => :'BOOLEAN',
    :'render_notes' => :'BOOLEAN',
    :'render_hidden_pages' => :'BOOLEAN',
    :'spreadsheet_options' => :'SpreadsheetOptions',
    :'cad_options' => :'CadOptions',
    :'email_options' => :'EmailOptions',
    :'project_management_options' => :'ProjectManagementOptions',
    :'pdf_document_options' => :'PdfDocumentOptions',
    :'word_processing_options' => :'WordProcessingOptions',
    :'outlook_options' => :'OutlookOptions',
    :'archive_options' => :'ArchiveOptions',
    :'text_options' => :'TextOptions',
    :'mail_storage_options' => :'MailStorageOptions',
    :'visio_rendering_options' => :'VisioRenderingOptions',
    :'web_document_options' => :'WebDocumentOptions',
    :'width' => :'Integer',
    :'height' => :'Integer',
    :'extract_text' => :'BOOLEAN',
    :'jpeg_quality' => :'Integer',
    :'max_width' => :'Integer',
    :'max_height' => :'Integer'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 382

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      start_page_number == other.start_page_number &&
      count_pages_to_render == other.count_pages_to_render &&
      pages_to_render == other.pages_to_render &&
      page_rotations == other.page_rotations &&
      default_font_name == other.default_font_name &&
      default_encoding == other.default_encoding &&
      detect_encoding == other.detect_encoding &&
      render_comments == other.render_comments &&
      render_notes == other.render_notes &&
      render_hidden_pages == other.render_hidden_pages &&
      spreadsheet_options == other.spreadsheet_options &&
      cad_options == other.cad_options &&
      email_options == other.email_options &&
      project_management_options == other.project_management_options &&
      pdf_document_options == other.pdf_document_options &&
      word_processing_options == other.word_processing_options &&
      outlook_options == other.outlook_options &&
      archive_options == other.archive_options &&
      text_options == other.text_options &&
      mail_storage_options == other.mail_storage_options &&
      visio_rendering_options == other.visio_rendering_options &&
      web_document_options == other.web_document_options &&
      width == other.width &&
      height == other.height &&
      extract_text == other.extract_text &&
      jpeg_quality == other.jpeg_quality &&
      max_width == other.max_width &&
      max_height == other.max_height
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 460

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Date.parse value
  when :Date
    Date.parse value
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else
  # model
    temp_model = GroupDocsViewerCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 527

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 436

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    pname = uncap(self.class.attribute_map[key]).intern
    value = attributes[pname]
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not                    
      if value.is_a?(Array)
        self.send("#{key}=", value.map { |v| _deserialize($1, v) })
      end
    elsif !value.nil?
      self.send("#{key}=", _deserialize(type, value))
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


417
418
419
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 417

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



423
424
425
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 423

def hash
  [start_page_number, count_pages_to_render, pages_to_render, page_rotations, default_font_name, default_encoding, detect_encoding, render_comments, render_notes, render_hidden_pages, spreadsheet_options, cad_options, email_options, project_management_options, pdf_document_options, word_processing_options, outlook_options, archive_options, text_options, mail_storage_options, visio_rendering_options, web_document_options, width, height, extract_text, jpeg_quality, max_width, max_height].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 314

def list_invalid_properties
  invalid_properties = []
  if @start_page_number.nil?
    invalid_properties.push("invalid value for 'start_page_number', start_page_number cannot be nil.")
  end

  if @count_pages_to_render.nil?
    invalid_properties.push("invalid value for 'count_pages_to_render', count_pages_to_render cannot be nil.")
  end

  if @render_comments.nil?
    invalid_properties.push("invalid value for 'render_comments', render_comments cannot be nil.")
  end

  if @render_notes.nil?
    invalid_properties.push("invalid value for 'render_notes', render_notes cannot be nil.")
  end

  if @render_hidden_pages.nil?
    invalid_properties.push("invalid value for 'render_hidden_pages', render_hidden_pages cannot be nil.")
  end

  if @width.nil?
    invalid_properties.push("invalid value for 'width', width cannot be nil.")
  end

  if @height.nil?
    invalid_properties.push("invalid value for 'height', height cannot be nil.")
  end

  if @extract_text.nil?
    invalid_properties.push("invalid value for 'extract_text', extract_text cannot be nil.")
  end

  if @jpeg_quality.nil?
    invalid_properties.push("invalid value for 'jpeg_quality', jpeg_quality cannot be nil.")
  end

  if @max_width.nil?
    invalid_properties.push("invalid value for 'max_width', max_width cannot be nil.")
  end

  if @max_height.nil?
    invalid_properties.push("invalid value for 'max_height', max_height cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



507
508
509
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 507

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



513
514
515
516
517
518
519
520
521
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 513

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



501
502
503
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 501

def to_s
  to_hash.to_s
end

#uncap(str) ⇒ Object

Downcases first letter.

Returns:

  • downcased string



429
430
431
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 429

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

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/groupdocs_viewer_cloud/models/image_options.rb', line 365

def valid?
  return false if @start_page_number.nil?
  return false if @count_pages_to_render.nil?
  return false if @render_comments.nil?
  return false if @render_notes.nil?
  return false if @render_hidden_pages.nil?
  return false if @width.nil?
  return false if @height.nil?
  return false if @extract_text.nil?
  return false if @jpeg_quality.nil?
  return false if @max_width.nil?
  return false if @max_height.nil?
  return true
end