aspose_pdf_cloud 19.2.0 → 19.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -5
  3. data/docs/CellRecognized.md +10 -0
  4. data/docs/ImageStamp.md +25 -0
  5. data/docs/PdfApi.md +419 -3
  6. data/docs/PdfPageStamp.md +24 -0
  7. data/docs/Position.md +10 -0
  8. data/docs/RowRecognized.md +10 -0
  9. data/docs/StampBase.md +22 -0
  10. data/docs/StampInfo.md +16 -0
  11. data/docs/StampsInfo.md +10 -0
  12. data/docs/StampsInfoResponse.md +11 -0
  13. data/docs/TableRecognized.md +13 -0
  14. data/docs/TableRecognizedResponse.md +11 -0
  15. data/docs/TablesRecognized.md +10 -0
  16. data/docs/TablesRecognizedResponse.md +11 -0
  17. data/docs/TextRect.md +6 -1
  18. data/docs/TextStamp.md +25 -0
  19. data/lib/aspose_pdf_cloud.rb +14 -0
  20. data/lib/aspose_pdf_cloud/api/pdf_api.rb +1450 -204
  21. data/lib/aspose_pdf_cloud/models/cell_recognized.rb +211 -0
  22. data/lib/aspose_pdf_cloud/models/image_stamp.rb +363 -0
  23. data/lib/aspose_pdf_cloud/models/pdf_page_stamp.rb +353 -0
  24. data/lib/aspose_pdf_cloud/models/position.rb +221 -0
  25. data/lib/aspose_pdf_cloud/models/row_recognized.rb +213 -0
  26. data/lib/aspose_pdf_cloud/models/stamp_base.rb +333 -0
  27. data/lib/aspose_pdf_cloud/models/stamp_info.rb +273 -0
  28. data/lib/aspose_pdf_cloud/models/stamps_info.rb +215 -0
  29. data/lib/aspose_pdf_cloud/models/stamps_info_response.rb +226 -0
  30. data/lib/aspose_pdf_cloud/models/table_recognized.rb +245 -0
  31. data/lib/aspose_pdf_cloud/models/table_recognized_response.rb +226 -0
  32. data/lib/aspose_pdf_cloud/models/tables_recognized.rb +215 -0
  33. data/lib/aspose_pdf_cloud/models/tables_recognized_response.rb +226 -0
  34. data/lib/aspose_pdf_cloud/models/text_rect.rb +54 -9
  35. data/lib/aspose_pdf_cloud/models/text_stamp.rb +363 -0
  36. data/lib/aspose_pdf_cloud/version.rb +1 -1
  37. data/test/pdf_tests.rb +260 -3
  38. data/test_data/PageNumberStamp.pdf +0 -0
  39. data/test_data/PdfWithTable.pdf +0 -0
  40. metadata +32 -2
@@ -34,13 +34,33 @@ module AsposePdfCloud
34
34
  # Rectangle of the occurrence.
35
35
  attr_accessor :rect
36
36
 
37
+ # Gets or sets a horizontal alignment of text fragment.
38
+ attr_accessor :horizontal_alignment
39
+
40
+ # Gets or sets a vertical alignment of text fragment.
41
+ attr_accessor :vertical_alignment
42
+
43
+ # Gets or sets text position for text, represented with object.
44
+ attr_accessor :position
45
+
46
+ # Gets text position for text, represented with object. The YIndent of the Position structure represents baseline coordinate of the text fragment.
47
+ attr_accessor :baseline_position
48
+
49
+ # Gets or sets text state for the text that object represents.
50
+ attr_accessor :text_state
51
+
37
52
 
38
53
  # Attribute mapping from ruby-style variable name to JSON key.
39
54
  def self.attribute_map
40
55
  {
41
56
  :'text' => :'Text',
42
57
  :'page' => :'Page',
43
- :'rect' => :'Rect'
58
+ :'rect' => :'Rect',
59
+ :'horizontal_alignment' => :'HorizontalAlignment',
60
+ :'vertical_alignment' => :'VerticalAlignment',
61
+ :'position' => :'Position',
62
+ :'baseline_position' => :'BaselinePosition',
63
+ :'text_state' => :'TextState'
44
64
  }
45
65
  end
46
66
 
@@ -49,7 +69,12 @@ module AsposePdfCloud
49
69
  {
50
70
  :'text' => :'String',
51
71
  :'page' => :'Integer',
52
- :'rect' => :'Rectangle'
72
+ :'rect' => :'Rectangle',
73
+ :'horizontal_alignment' => :'HorizontalAlignment',
74
+ :'vertical_alignment' => :'VerticalAlignment',
75
+ :'position' => :'Position',
76
+ :'baseline_position' => :'Position',
77
+ :'text_state' => :'TextState'
53
78
  }
54
79
  end
55
80
 
@@ -73,23 +98,38 @@ module AsposePdfCloud
73
98
  self.rect = attributes[:'Rect']
74
99
  end
75
100
 
101
+ if attributes.has_key?(:'HorizontalAlignment')
102
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
103
+ end
104
+
105
+ if attributes.has_key?(:'VerticalAlignment')
106
+ self.vertical_alignment = attributes[:'VerticalAlignment']
107
+ end
108
+
109
+ if attributes.has_key?(:'Position')
110
+ self.position = attributes[:'Position']
111
+ end
112
+
113
+ if attributes.has_key?(:'BaselinePosition')
114
+ self.baseline_position = attributes[:'BaselinePosition']
115
+ end
116
+
117
+ if attributes.has_key?(:'TextState')
118
+ self.text_state = attributes[:'TextState']
119
+ end
120
+
76
121
  end
77
122
 
78
123
  # Show invalid properties with the reasons. Usually used together with valid?
79
124
  # @return Array for valid properies with the reasons
80
125
  def list_invalid_properties
81
126
  invalid_properties = Array.new
82
- if @page.nil?
83
- invalid_properties.push("invalid value for 'page', page cannot be nil.")
84
- end
85
-
86
127
  return invalid_properties
87
128
  end
88
129
 
89
130
  # Check to see if the all the properties in the model are valid
90
131
  # @return true if the model is valid
91
132
  def valid?
92
- return false if @page.nil?
93
133
  return true
94
134
  end
95
135
 
@@ -100,7 +140,12 @@ module AsposePdfCloud
100
140
  self.class == o.class &&
101
141
  text == o.text &&
102
142
  page == o.page &&
103
- rect == o.rect
143
+ rect == o.rect &&
144
+ horizontal_alignment == o.horizontal_alignment &&
145
+ vertical_alignment == o.vertical_alignment &&
146
+ position == o.position &&
147
+ baseline_position == o.baseline_position &&
148
+ text_state == o.text_state
104
149
  end
105
150
 
106
151
  # @see the `==` method
@@ -112,7 +157,7 @@ module AsposePdfCloud
112
157
  # Calculates hash code according to all attributes.
113
158
  # @return [Fixnum] Hash code
114
159
  def hash
115
- [text, page, rect].hash
160
+ [text, page, rect, horizontal_alignment, vertical_alignment, position, baseline_position, text_state].hash
116
161
  end
117
162
 
118
163
  # Builds the object from hash
@@ -0,0 +1,363 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2019 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 Pdf stamps.
27
+ class TextStamp
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.
32
+ attr_accessor :background
33
+
34
+ # Gets or sets bottom margin of stamp.
35
+ attr_accessor :bottom_margin
36
+
37
+ # Gets or sets Horizontal alignment of stamp on the page.
38
+ attr_accessor :horizontal_alignment
39
+
40
+ # Gets or sets left margin of stamp.
41
+ attr_accessor :left_margin
42
+
43
+ # Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.
44
+ attr_accessor :opacity
45
+
46
+ # Gets or sets right margin of stamp.
47
+ attr_accessor :right_margin
48
+
49
+ # Sets or gets the rotation of stamp content according values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.
50
+ attr_accessor :rotate
51
+
52
+ # Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle.
53
+ attr_accessor :rotate_angle
54
+
55
+ # Gets or sets top margin of stamp.
56
+ attr_accessor :top_margin
57
+
58
+ # Gets or sets vertical alignment of stamp on page.
59
+ attr_accessor :vertical_alignment
60
+
61
+ # Horizontal stamp coordinate, starting from the left.
62
+ attr_accessor :x_indent
63
+
64
+ # Vertical stamp coordinate, starting from the bottom.
65
+ attr_accessor :y_indent
66
+
67
+ # Zooming factor of the stamp. Allows to scale stamp.
68
+ attr_accessor :zoom
69
+
70
+ # Alignment of the text inside the stamp.
71
+ attr_accessor :text_alignment
72
+
73
+ # Gets or sets string value which is used as stamp on the page.
74
+ attr_accessor :value
75
+
76
+ # Gets text properties of the stamp. See for details.
77
+ attr_accessor :text_state
78
+
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'links' => :'Links',
84
+ :'background' => :'Background',
85
+ :'bottom_margin' => :'BottomMargin',
86
+ :'horizontal_alignment' => :'HorizontalAlignment',
87
+ :'left_margin' => :'LeftMargin',
88
+ :'opacity' => :'Opacity',
89
+ :'right_margin' => :'RightMargin',
90
+ :'rotate' => :'Rotate',
91
+ :'rotate_angle' => :'RotateAngle',
92
+ :'top_margin' => :'TopMargin',
93
+ :'vertical_alignment' => :'VerticalAlignment',
94
+ :'x_indent' => :'XIndent',
95
+ :'y_indent' => :'YIndent',
96
+ :'zoom' => :'Zoom',
97
+ :'text_alignment' => :'TextAlignment',
98
+ :'value' => :'Value',
99
+ :'text_state' => :'TextState'
100
+ }
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.swagger_types
105
+ {
106
+ :'links' => :'Array<Link>',
107
+ :'background' => :'BOOLEAN',
108
+ :'bottom_margin' => :'Float',
109
+ :'horizontal_alignment' => :'HorizontalAlignment',
110
+ :'left_margin' => :'Float',
111
+ :'opacity' => :'Float',
112
+ :'right_margin' => :'Float',
113
+ :'rotate' => :'Rotation',
114
+ :'rotate_angle' => :'Float',
115
+ :'top_margin' => :'Float',
116
+ :'vertical_alignment' => :'VerticalAlignment',
117
+ :'x_indent' => :'Float',
118
+ :'y_indent' => :'Float',
119
+ :'zoom' => :'Float',
120
+ :'text_alignment' => :'HorizontalAlignment',
121
+ :'value' => :'String',
122
+ :'text_state' => :'TextState'
123
+ }
124
+ end
125
+
126
+ # Initializes the object
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ def initialize(attributes = {})
129
+ return unless attributes.is_a?(Hash)
130
+
131
+ # convert string to symbol for hash key
132
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
133
+
134
+ if attributes.has_key?(:'Links')
135
+ if (value = attributes[:'Links']).is_a?(Array)
136
+ self.links = value
137
+ end
138
+ end
139
+
140
+ if attributes.has_key?(:'Background')
141
+ self.background = attributes[:'Background']
142
+ end
143
+
144
+ if attributes.has_key?(:'BottomMargin')
145
+ self.bottom_margin = attributes[:'BottomMargin']
146
+ end
147
+
148
+ if attributes.has_key?(:'HorizontalAlignment')
149
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
150
+ end
151
+
152
+ if attributes.has_key?(:'LeftMargin')
153
+ self.left_margin = attributes[:'LeftMargin']
154
+ end
155
+
156
+ if attributes.has_key?(:'Opacity')
157
+ self.opacity = attributes[:'Opacity']
158
+ end
159
+
160
+ if attributes.has_key?(:'RightMargin')
161
+ self.right_margin = attributes[:'RightMargin']
162
+ end
163
+
164
+ if attributes.has_key?(:'Rotate')
165
+ self.rotate = attributes[:'Rotate']
166
+ end
167
+
168
+ if attributes.has_key?(:'RotateAngle')
169
+ self.rotate_angle = attributes[:'RotateAngle']
170
+ end
171
+
172
+ if attributes.has_key?(:'TopMargin')
173
+ self.top_margin = attributes[:'TopMargin']
174
+ end
175
+
176
+ if attributes.has_key?(:'VerticalAlignment')
177
+ self.vertical_alignment = attributes[:'VerticalAlignment']
178
+ end
179
+
180
+ if attributes.has_key?(:'XIndent')
181
+ self.x_indent = attributes[:'XIndent']
182
+ end
183
+
184
+ if attributes.has_key?(:'YIndent')
185
+ self.y_indent = attributes[:'YIndent']
186
+ end
187
+
188
+ if attributes.has_key?(:'Zoom')
189
+ self.zoom = attributes[:'Zoom']
190
+ end
191
+
192
+ if attributes.has_key?(:'TextAlignment')
193
+ self.text_alignment = attributes[:'TextAlignment']
194
+ end
195
+
196
+ if attributes.has_key?(:'Value')
197
+ self.value = attributes[:'Value']
198
+ end
199
+
200
+ if attributes.has_key?(:'TextState')
201
+ self.text_state = attributes[:'TextState']
202
+ end
203
+
204
+ end
205
+
206
+ # Show invalid properties with the reasons. Usually used together with valid?
207
+ # @return Array for valid properies with the reasons
208
+ def list_invalid_properties
209
+ invalid_properties = Array.new
210
+ return invalid_properties
211
+ end
212
+
213
+ # Check to see if the all the properties in the model are valid
214
+ # @return true if the model is valid
215
+ def valid?
216
+ return true
217
+ end
218
+
219
+ # Checks equality by comparing each attribute.
220
+ # @param [Object] Object to be compared
221
+ def ==(o)
222
+ return true if self.equal?(o)
223
+ self.class == o.class &&
224
+ links == o.links &&
225
+ background == o.background &&
226
+ bottom_margin == o.bottom_margin &&
227
+ horizontal_alignment == o.horizontal_alignment &&
228
+ left_margin == o.left_margin &&
229
+ opacity == o.opacity &&
230
+ right_margin == o.right_margin &&
231
+ rotate == o.rotate &&
232
+ rotate_angle == o.rotate_angle &&
233
+ top_margin == o.top_margin &&
234
+ vertical_alignment == o.vertical_alignment &&
235
+ x_indent == o.x_indent &&
236
+ y_indent == o.y_indent &&
237
+ zoom == o.zoom &&
238
+ text_alignment == o.text_alignment &&
239
+ value == o.value &&
240
+ text_state == o.text_state
241
+ end
242
+
243
+ # @see the `==` method
244
+ # @param [Object] Object to be compared
245
+ def eql?(o)
246
+ self == o
247
+ end
248
+
249
+ # Calculates hash code according to all attributes.
250
+ # @return [Fixnum] Hash code
251
+ def hash
252
+ [links, background, bottom_margin, horizontal_alignment, left_margin, opacity, right_margin, rotate, rotate_angle, top_margin, vertical_alignment, x_indent, y_indent, zoom, text_alignment, value, text_state].hash
253
+ end
254
+
255
+ # Builds the object from hash
256
+ # @param [Hash] attributes Model attributes in the form of hash
257
+ # @return [Object] Returns the model itself
258
+ def build_from_hash(attributes)
259
+ return nil unless attributes.is_a?(Hash)
260
+ self.class.swagger_types.each_pair do |key, type|
261
+ if type =~ /\AArray<(.*)>/i
262
+ # check to ensure the input is an array given that the the attribute
263
+ # is documented as an array but the input is not
264
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
265
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
266
+ end
267
+ elsif !attributes[self.class.attribute_map[key]].nil?
268
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
269
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
270
+ end
271
+
272
+ self
273
+ end
274
+
275
+ # Deserializes the data based on type
276
+ # @param string type Data type
277
+ # @param string value Value to be deserialized
278
+ # @return [Object] Deserialized data
279
+ def _deserialize(type, value)
280
+ case type.to_sym
281
+ when :DateTime
282
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
283
+ Time.strptime(value, format).utc.to_datetime
284
+ when :Date
285
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
286
+ Time.strptime(value, format).utc.to_datetime.to_date
287
+ when :String
288
+ value.to_s
289
+ when :Integer
290
+ value.to_i
291
+ when :Float
292
+ value.to_f
293
+ when :BOOLEAN
294
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
295
+ true
296
+ else
297
+ false
298
+ end
299
+ when :Object
300
+ # generic object (usually a Hash), return directly
301
+ value
302
+ when /\AArray<(?<inner_type>.+)>\z/
303
+ inner_type = Regexp.last_match[:inner_type]
304
+ value.map { |v| _deserialize(inner_type, v) }
305
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
306
+ k_type = Regexp.last_match[:k_type]
307
+ v_type = Regexp.last_match[:v_type]
308
+ {}.tap do |hash|
309
+ value.each do |k, v|
310
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
311
+ end
312
+ end
313
+ else # model
314
+ temp_model = AsposePdfCloud.const_get(type).new
315
+ temp_model.build_from_hash(value)
316
+ end
317
+ end
318
+
319
+ # Returns the string representation of the object
320
+ # @return [String] String presentation of the object
321
+ def to_s
322
+ to_hash.to_s
323
+ end
324
+
325
+ # to_body is an alias to to_hash (backward compatibility)
326
+ # @return [Hash] Returns the object in the form of hash
327
+ def to_body
328
+ to_hash
329
+ end
330
+
331
+ # Returns the object in the form of hash
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_hash
334
+ hash = {}
335
+ self.class.attribute_map.each_pair do |attr, param|
336
+ value = self.send(attr)
337
+ next if value.nil?
338
+ hash[param] = _to_hash(value)
339
+ end
340
+ hash
341
+ end
342
+
343
+ # Outputs non-array value in the form of hash
344
+ # For object, use to_hash. Otherwise, just return the value
345
+ # @param [Object] value Any valid value
346
+ # @return [Hash] Returns the value in the form of hash
347
+ def _to_hash(value)
348
+ if value.is_a?(Array)
349
+ value.compact.map{ |v| _to_hash(v) }
350
+ elsif value.is_a?(Hash)
351
+ {}.tap do |hash|
352
+ value.each { |k, v| hash[k] = _to_hash(v) }
353
+ end
354
+ elsif value.respond_to? :to_hash
355
+ value.to_hash
356
+ else
357
+ value
358
+ end
359
+ end
360
+
361
+ end
362
+
363
+ end