aspose_pdf_cloud 20.1.0 → 20.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -13
  3. data/docs/ApiInfo.md +10 -0
  4. data/docs/Cell.md +3 -0
  5. data/docs/CheckBoxField.md +1 -0
  6. data/docs/ChoiceField.md +1 -0
  7. data/docs/ComboBoxField.md +1 -0
  8. data/docs/FormField.md +1 -0
  9. data/docs/ImageCompressionVersion.md +12 -0
  10. data/docs/ImageEncoding.md +13 -0
  11. data/docs/ImageFragment.md +15 -0
  12. data/docs/ListBoxField.md +1 -0
  13. data/docs/OptimizeOptions.md +13 -7
  14. data/docs/OutputFormat.md +11 -0
  15. data/docs/PdfAType.md +3 -2
  16. data/docs/PdfApi.md +223 -26
  17. data/docs/RadioButtonField.md +1 -0
  18. data/docs/RadioButtonOptionField.md +1 -0
  19. data/docs/SignatureField.md +1 -0
  20. data/docs/TextBoxField.md +1 -0
  21. data/lib/aspose_pdf_cloud.rb +5 -0
  22. data/lib/aspose_pdf_cloud/api/pdf_api.rb +635 -43
  23. data/lib/aspose_pdf_cloud/api_client.rb +1 -1
  24. data/lib/aspose_pdf_cloud/models/api_info.rb +209 -0
  25. data/lib/aspose_pdf_cloud/models/cell.rb +36 -4
  26. data/lib/aspose_pdf_cloud/models/check_box_field.rb +11 -1
  27. data/lib/aspose_pdf_cloud/models/choice_field.rb +11 -1
  28. data/lib/aspose_pdf_cloud/models/combo_box_field.rb +11 -1
  29. data/lib/aspose_pdf_cloud/models/form_field.rb +11 -1
  30. data/lib/aspose_pdf_cloud/models/image_compression_version.rb +45 -0
  31. data/lib/aspose_pdf_cloud/models/image_encoding.rb +46 -0
  32. data/lib/aspose_pdf_cloud/models/image_fragment.rb +283 -0
  33. data/lib/aspose_pdf_cloud/models/list_box_field.rb +11 -1
  34. data/lib/aspose_pdf_cloud/models/optimize_options.rb +60 -35
  35. data/lib/aspose_pdf_cloud/models/output_format.rb +44 -0
  36. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +1 -0
  37. data/lib/aspose_pdf_cloud/models/radio_button_field.rb +11 -1
  38. data/lib/aspose_pdf_cloud/models/radio_button_option_field.rb +11 -1
  39. data/lib/aspose_pdf_cloud/models/signature_field.rb +11 -1
  40. data/lib/aspose_pdf_cloud/models/text_box_field.rb +11 -1
  41. data/lib/aspose_pdf_cloud/version.rb +1 -1
  42. data/test/pdf_tests.rb +157 -96
  43. data/test_data/4pagesPdfA.pdf +0 -0
  44. metadata +13 -2
@@ -31,6 +31,9 @@ module AsposePdfCloud
31
31
  # Field name.
32
32
  attr_accessor :partial_name
33
33
 
34
+ # Full Field name.
35
+ attr_accessor :full_name
36
+
34
37
  # Field rectangle.
35
38
  attr_accessor :rect
36
39
 
@@ -88,6 +91,7 @@ module AsposePdfCloud
88
91
  {
89
92
  :'links' => :'Links',
90
93
  :'partial_name' => :'PartialName',
94
+ :'full_name' => :'FullName',
91
95
  :'rect' => :'Rect',
92
96
  :'value' => :'Value',
93
97
  :'page_index' => :'PageIndex',
@@ -113,6 +117,7 @@ module AsposePdfCloud
113
117
  {
114
118
  :'links' => :'Array<Link>',
115
119
  :'partial_name' => :'String',
120
+ :'full_name' => :'String',
116
121
  :'rect' => :'Rectangle',
117
122
  :'value' => :'String',
118
123
  :'page_index' => :'Integer',
@@ -151,6 +156,10 @@ module AsposePdfCloud
151
156
  self.partial_name = attributes[:'PartialName']
152
157
  end
153
158
 
159
+ if attributes.has_key?(:'FullName')
160
+ self.full_name = attributes[:'FullName']
161
+ end
162
+
154
163
  if attributes.has_key?(:'Rect')
155
164
  self.rect = attributes[:'Rect']
156
165
  end
@@ -248,6 +257,7 @@ module AsposePdfCloud
248
257
  self.class == o.class &&
249
258
  links == o.links &&
250
259
  partial_name == o.partial_name &&
260
+ full_name == o.full_name &&
251
261
  rect == o.rect &&
252
262
  value == o.value &&
253
263
  page_index == o.page_index &&
@@ -276,7 +286,7 @@ module AsposePdfCloud
276
286
  # Calculates hash code according to all attributes.
277
287
  # @return [Fixnum] Hash code
278
288
  def hash
279
- [links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border].hash
289
+ [links, partial_name, full_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border].hash
280
290
  end
281
291
 
282
292
  # Builds the object from hash
@@ -0,0 +1,45 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2020 Aspose.PDF Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+ class ImageCompressionVersion
27
+
28
+ STANDARD = "Standard".freeze
29
+ FAST = "Fast".freeze
30
+ MIXED = "Mixed".freeze
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
37
+ # consantValues = ImageCompressionVersion.constants.select{|c| c.to_s == value}
38
+ constantValues = ImageCompressionVersion.constants.select{ |const_name| ImageCompressionVersion.const_get(const_name) == value}
39
+
40
+ raise "Invalid ENUM value #{value} for class #ImageCompressionVersion" if constantValues.empty?
41
+ value
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,46 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2020 Aspose.PDF Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+ class ImageEncoding
27
+
28
+ UNCHANGED = "Unchanged".freeze
29
+ JPEG = "Jpeg".freeze
30
+ FLATE = "Flate".freeze
31
+ JPEG2000 = "Jpeg2000".freeze
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
38
+ # consantValues = ImageEncoding.constants.select{|c| c.to_s == value}
39
+ constantValues = ImageEncoding.constants.select{ |const_name| ImageEncoding.const_get(const_name) == value}
40
+
41
+ raise "Invalid ENUM value #{value} for class #ImageEncoding" if constantValues.empty?
42
+ value
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,283 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2020 Aspose.PDF Cloud
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
19
+ --------------------------------------------------------------------------------------------------------------------
20
+ =end
21
+
22
+ require 'date'
23
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+ # Represents Image Fragment DTO.
27
+ class ImageFragment
28
+ # Gets or sets full storage path of image.
29
+ attr_accessor :image_file
30
+
31
+ # Gets or sets fix width of the image.
32
+ attr_accessor :fix_width
33
+
34
+ # Gets or sets fix height of the image.
35
+ attr_accessor :fix_height
36
+
37
+ # Gets or sets horizontal alignment of the image.
38
+ attr_accessor :horizontal_alignment
39
+
40
+ # Gets or sets vertical alignment of the image.
41
+ attr_accessor :vertical_alignment
42
+
43
+ # Gets or sets ImageScale of the image.
44
+ attr_accessor :image_scale
45
+
46
+ # Gets or sets Margin of the image.
47
+ attr_accessor :margin
48
+
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'image_file' => :'ImageFile',
54
+ :'fix_width' => :'FixWidth',
55
+ :'fix_height' => :'FixHeight',
56
+ :'horizontal_alignment' => :'HorizontalAlignment',
57
+ :'vertical_alignment' => :'VerticalAlignment',
58
+ :'image_scale' => :'ImageScale',
59
+ :'margin' => :'Margin'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.swagger_types
65
+ {
66
+ :'image_file' => :'String',
67
+ :'fix_width' => :'Float',
68
+ :'fix_height' => :'Float',
69
+ :'horizontal_alignment' => :'HorizontalAlignment',
70
+ :'vertical_alignment' => :'VerticalAlignment',
71
+ :'image_scale' => :'Float',
72
+ :'margin' => :'MarginInfo'
73
+ }
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ return unless attributes.is_a?(Hash)
80
+
81
+ # convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
83
+
84
+ if attributes.has_key?(:'ImageFile')
85
+ self.image_file = attributes[:'ImageFile']
86
+ end
87
+
88
+ if attributes.has_key?(:'FixWidth')
89
+ self.fix_width = attributes[:'FixWidth']
90
+ end
91
+
92
+ if attributes.has_key?(:'FixHeight')
93
+ self.fix_height = attributes[:'FixHeight']
94
+ end
95
+
96
+ if attributes.has_key?(:'HorizontalAlignment')
97
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
98
+ end
99
+
100
+ if attributes.has_key?(:'VerticalAlignment')
101
+ self.vertical_alignment = attributes[:'VerticalAlignment']
102
+ end
103
+
104
+ if attributes.has_key?(:'ImageScale')
105
+ self.image_scale = attributes[:'ImageScale']
106
+ end
107
+
108
+ if attributes.has_key?(:'Margin')
109
+ self.margin = attributes[:'Margin']
110
+ end
111
+
112
+ end
113
+
114
+ # Show invalid properties with the reasons. Usually used together with valid?
115
+ # @return Array for valid properies with the reasons
116
+ def list_invalid_properties
117
+ invalid_properties = Array.new
118
+ if @image_file.nil?
119
+ invalid_properties.push("invalid value for 'image_file', image_file cannot be nil.")
120
+ end
121
+
122
+ if @image_file.to_s.length < 1
123
+ invalid_properties.push("invalid value for 'image_file', the character length must be great than or equal to 1.")
124
+ end
125
+
126
+ return invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ return false if @image_file.nil?
133
+ return false if @image_file.to_s.length < 1
134
+ return true
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] image_file Value to be assigned
139
+ def image_file=(image_file)
140
+ if image_file.nil?
141
+ fail ArgumentError, "image_file cannot be nil"
142
+ end
143
+
144
+ if image_file.to_s.length < 1
145
+ fail ArgumentError, "invalid value for 'image_file', the character length must be great than or equal to 1."
146
+ end
147
+
148
+ @image_file = image_file
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ image_file == o.image_file &&
157
+ fix_width == o.fix_width &&
158
+ fix_height == o.fix_height &&
159
+ horizontal_alignment == o.horizontal_alignment &&
160
+ vertical_alignment == o.vertical_alignment &&
161
+ image_scale == o.image_scale &&
162
+ margin == o.margin
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Fixnum] Hash code
173
+ def hash
174
+ [image_file, fix_width, fix_height, horizontal_alignment, vertical_alignment, image_scale, margin].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def build_from_hash(attributes)
181
+ return nil unless attributes.is_a?(Hash)
182
+ self.class.swagger_types.each_pair do |key, type|
183
+ if type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
187
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
188
+ end
189
+ elsif !attributes[self.class.attribute_map[key]].nil?
190
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
191
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
192
+ end
193
+
194
+ self
195
+ end
196
+
197
+ # Deserializes the data based on type
198
+ # @param string type Data type
199
+ # @param string value Value to be deserialized
200
+ # @return [Object] Deserialized data
201
+ def _deserialize(type, value)
202
+ case type.to_sym
203
+ when :DateTime
204
+ DateTime.parse(value)
205
+ when :Date
206
+ Date.parse(value)
207
+ when :String
208
+ value.to_s
209
+ when :Integer
210
+ value.to_i
211
+ when :Float
212
+ value.to_f
213
+ when :BOOLEAN
214
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
215
+ true
216
+ else
217
+ false
218
+ end
219
+ when :Object
220
+ # generic object (usually a Hash), return directly
221
+ value
222
+ when /\AArray<(?<inner_type>.+)>\z/
223
+ inner_type = Regexp.last_match[:inner_type]
224
+ value.map { |v| _deserialize(inner_type, v) }
225
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
226
+ k_type = Regexp.last_match[:k_type]
227
+ v_type = Regexp.last_match[:v_type]
228
+ {}.tap do |hash|
229
+ value.each do |k, v|
230
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
+ end
232
+ end
233
+ else # model
234
+ temp_model = AsposePdfCloud.const_get(type).new
235
+ temp_model.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ # Returns the string representation of the object
240
+ # @return [String] String presentation of the object
241
+ def to_s
242
+ to_hash.to_s
243
+ end
244
+
245
+ # to_body is an alias to to_hash (backward compatibility)
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_body
248
+ to_hash
249
+ end
250
+
251
+ # Returns the object in the form of hash
252
+ # @return [Hash] Returns the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ next if value.nil?
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Outputs non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ # @param [Object] value Any valid value
266
+ # @return [Hash] Returns the value in the form of hash
267
+ def _to_hash(value)
268
+ if value.is_a?(Array)
269
+ value.compact.map{ |v| _to_hash(v) }
270
+ elsif value.is_a?(Hash)
271
+ {}.tap do |hash|
272
+ value.each { |k, v| hash[k] = _to_hash(v) }
273
+ end
274
+ elsif value.respond_to? :to_hash
275
+ value.to_hash
276
+ else
277
+ value
278
+ end
279
+ end
280
+
281
+ end
282
+
283
+ end
@@ -31,6 +31,9 @@ module AsposePdfCloud
31
31
  # Field name.
32
32
  attr_accessor :partial_name
33
33
 
34
+ # Full Field name.
35
+ attr_accessor :full_name
36
+
34
37
  # Field rectangle.
35
38
  attr_accessor :rect
36
39
 
@@ -106,6 +109,7 @@ module AsposePdfCloud
106
109
  {
107
110
  :'links' => :'Links',
108
111
  :'partial_name' => :'PartialName',
112
+ :'full_name' => :'FullName',
109
113
  :'rect' => :'Rect',
110
114
  :'value' => :'Value',
111
115
  :'page_index' => :'PageIndex',
@@ -137,6 +141,7 @@ module AsposePdfCloud
137
141
  {
138
142
  :'links' => :'Array<Link>',
139
143
  :'partial_name' => :'String',
144
+ :'full_name' => :'String',
140
145
  :'rect' => :'Rectangle',
141
146
  :'value' => :'String',
142
147
  :'page_index' => :'Integer',
@@ -181,6 +186,10 @@ module AsposePdfCloud
181
186
  self.partial_name = attributes[:'PartialName']
182
187
  end
183
188
 
189
+ if attributes.has_key?(:'FullName')
190
+ self.full_name = attributes[:'FullName']
191
+ end
192
+
184
193
  if attributes.has_key?(:'Rect')
185
194
  self.rect = attributes[:'Rect']
186
195
  end
@@ -306,6 +315,7 @@ module AsposePdfCloud
306
315
  self.class == o.class &&
307
316
  links == o.links &&
308
317
  partial_name == o.partial_name &&
318
+ full_name == o.full_name &&
309
319
  rect == o.rect &&
310
320
  value == o.value &&
311
321
  page_index == o.page_index &&
@@ -340,7 +350,7 @@ module AsposePdfCloud
340
350
  # Calculates hash code according to all attributes.
341
351
  # @return [Fixnum] Hash code
342
352
  def hash
343
- [links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, multi_select, selected, options, active_state, top_index, selected_items].hash
353
+ [links, partial_name, full_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, border, multi_select, selected, options, active_state, top_index, selected_items].hash
344
354
  end
345
355
 
346
356
  # Builds the object from hash