aspose_pdf_cloud 19.3.0 → 19.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -5
  3. data/docs/BorderCornerStyle.md +11 -0
  4. data/docs/BorderInfo.md +13 -0
  5. data/docs/Cell.md +21 -0
  6. data/docs/ColumnAdjustment.md +12 -0
  7. data/docs/CryptoAlgorithm.md +14 -0
  8. data/docs/GraphInfo.md +19 -0
  9. data/docs/ImageFooter.md +23 -0
  10. data/docs/ImageHeader.md +23 -0
  11. data/docs/ImageStamp.md +5 -5
  12. data/docs/MarginInfo.md +5 -5
  13. data/docs/PageNumberStamp.md +24 -0
  14. data/docs/PdfApi.md +451 -27
  15. data/docs/PdfPageStamp.md +5 -5
  16. data/docs/PermissionsFlags.md +17 -0
  17. data/docs/Row.md +19 -0
  18. data/docs/StampBase.md +0 -5
  19. data/docs/Table.md +31 -0
  20. data/docs/TableBroken.md +12 -0
  21. data/docs/TextFooter.md +23 -0
  22. data/docs/TextHeader.md +23 -0
  23. data/docs/TextStamp.md +5 -5
  24. data/lib/aspose_pdf_cloud.rb +15 -0
  25. data/lib/aspose_pdf_cloud/api/pdf_api.rb +1530 -215
  26. data/lib/aspose_pdf_cloud/models/border_corner_style.rb +44 -0
  27. data/lib/aspose_pdf_cloud/models/border_info.rb +241 -0
  28. data/lib/aspose_pdf_cloud/models/cell.rb +323 -0
  29. data/lib/aspose_pdf_cloud/models/column_adjustment.rb +45 -0
  30. data/lib/aspose_pdf_cloud/models/crypto_algorithm.rb +46 -0
  31. data/lib/aspose_pdf_cloud/models/graph_info.rb +303 -0
  32. data/lib/aspose_pdf_cloud/models/image_footer.rb +343 -0
  33. data/lib/aspose_pdf_cloud/models/image_header.rb +343 -0
  34. data/lib/aspose_pdf_cloud/models/image_stamp.rb +54 -54
  35. data/lib/aspose_pdf_cloud/models/margin_info.rb +5 -21
  36. data/lib/aspose_pdf_cloud/models/page_number_stamp.rb +353 -0
  37. data/lib/aspose_pdf_cloud/models/pdf_page_stamp.rb +54 -54
  38. data/lib/aspose_pdf_cloud/models/permissions_flags.rb +50 -0
  39. data/lib/aspose_pdf_cloud/models/row.rb +308 -0
  40. data/lib/aspose_pdf_cloud/models/stamp_base.rb +1 -51
  41. data/lib/aspose_pdf_cloud/models/table.rb +425 -0
  42. data/lib/aspose_pdf_cloud/models/table_broken.rb +45 -0
  43. data/lib/aspose_pdf_cloud/models/text_footer.rb +343 -0
  44. data/lib/aspose_pdf_cloud/models/text_header.rb +343 -0
  45. data/lib/aspose_pdf_cloud/models/text_stamp.rb +54 -54
  46. data/lib/aspose_pdf_cloud/version.rb +1 -1
  47. data/test/pdf_tests.rb +407 -5
  48. data/test_data/4pagesEncrypted.pdf +0 -0
  49. metadata +33 -2
@@ -0,0 +1,425 @@
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 a table that can be added to the page.
27
+ class Table
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Gets HorizontalAlignment of the table alignment.
32
+ attr_accessor :alignment
33
+
34
+ # Gets HorizontalAlignment of the table alignment.
35
+ attr_accessor :horizontal_alignment
36
+
37
+ # Gets VerticalAlignment of the annotation.
38
+ attr_accessor :vertical_alignment
39
+
40
+ # Gets or sets the table top coordinate.
41
+ attr_accessor :top
42
+
43
+ # Gets or sets the table left coordinate.
44
+ attr_accessor :left
45
+
46
+ # Gets or sets the default cell text state.
47
+ attr_accessor :default_cell_text_state
48
+
49
+ # Gets or sets the default cell padding.
50
+ attr_accessor :default_cell_padding
51
+
52
+ # Gets or sets the border.
53
+ attr_accessor :border
54
+
55
+ # Sets the rows of the table.
56
+ attr_accessor :rows
57
+
58
+ # Gets default cell border;
59
+ attr_accessor :default_column_width
60
+
61
+ # Gets default cell border;
62
+ attr_accessor :default_cell_border
63
+
64
+ # Gets or sets table vertial broken;
65
+ attr_accessor :broken
66
+
67
+ # Gets the column widths of the table.
68
+ attr_accessor :column_widths
69
+
70
+ # Gets the first rows count repeated for several pages
71
+ attr_accessor :repeating_rows_count
72
+
73
+ # Gets or sets the maximum columns count for table
74
+ attr_accessor :repeating_columns_count
75
+
76
+ # Gets the style for repeating rows
77
+ attr_accessor :repeating_rows_style
78
+
79
+ # Gets or sets the styles of the border corners
80
+ attr_accessor :corner_style
81
+
82
+ # Gets or sets break text for table
83
+ attr_accessor :break_text
84
+
85
+ # Gets or sets table background color
86
+ attr_accessor :background_color
87
+
88
+ # Gets or sets border included in column widhts.
89
+ attr_accessor :is_borders_included
90
+
91
+ # Gets or sets the table column adjustment.
92
+ attr_accessor :column_adjustment
93
+
94
+ # Gets ZIndex of the annotation.
95
+ attr_accessor :z_index
96
+
97
+
98
+ # Attribute mapping from ruby-style variable name to JSON key.
99
+ def self.attribute_map
100
+ {
101
+ :'links' => :'Links',
102
+ :'alignment' => :'Alignment',
103
+ :'horizontal_alignment' => :'HorizontalAlignment',
104
+ :'vertical_alignment' => :'VerticalAlignment',
105
+ :'top' => :'Top',
106
+ :'left' => :'Left',
107
+ :'default_cell_text_state' => :'DefaultCellTextState',
108
+ :'default_cell_padding' => :'DefaultCellPadding',
109
+ :'border' => :'Border',
110
+ :'rows' => :'Rows',
111
+ :'default_column_width' => :'DefaultColumnWidth',
112
+ :'default_cell_border' => :'DefaultCellBorder',
113
+ :'broken' => :'Broken',
114
+ :'column_widths' => :'ColumnWidths',
115
+ :'repeating_rows_count' => :'RepeatingRowsCount',
116
+ :'repeating_columns_count' => :'RepeatingColumnsCount',
117
+ :'repeating_rows_style' => :'RepeatingRowsStyle',
118
+ :'corner_style' => :'CornerStyle',
119
+ :'break_text' => :'BreakText',
120
+ :'background_color' => :'BackgroundColor',
121
+ :'is_borders_included' => :'IsBordersIncluded',
122
+ :'column_adjustment' => :'ColumnAdjustment',
123
+ :'z_index' => :'ZIndex'
124
+ }
125
+ end
126
+
127
+ # Attribute type mapping.
128
+ def self.swagger_types
129
+ {
130
+ :'links' => :'Array<Link>',
131
+ :'alignment' => :'HorizontalAlignment',
132
+ :'horizontal_alignment' => :'HorizontalAlignment',
133
+ :'vertical_alignment' => :'VerticalAlignment',
134
+ :'top' => :'Float',
135
+ :'left' => :'Float',
136
+ :'default_cell_text_state' => :'TextState',
137
+ :'default_cell_padding' => :'MarginInfo',
138
+ :'border' => :'BorderInfo',
139
+ :'rows' => :'Array<Row>',
140
+ :'default_column_width' => :'String',
141
+ :'default_cell_border' => :'BorderInfo',
142
+ :'broken' => :'TableBroken',
143
+ :'column_widths' => :'String',
144
+ :'repeating_rows_count' => :'Integer',
145
+ :'repeating_columns_count' => :'Integer',
146
+ :'repeating_rows_style' => :'TextState',
147
+ :'corner_style' => :'BorderCornerStyle',
148
+ :'break_text' => :'TextRect',
149
+ :'background_color' => :'Color',
150
+ :'is_borders_included' => :'BOOLEAN',
151
+ :'column_adjustment' => :'ColumnAdjustment',
152
+ :'z_index' => :'Integer'
153
+ }
154
+ end
155
+
156
+ # Initializes the object
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ def initialize(attributes = {})
159
+ return unless attributes.is_a?(Hash)
160
+
161
+ # convert string to symbol for hash key
162
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
163
+
164
+ if attributes.has_key?(:'Links')
165
+ if (value = attributes[:'Links']).is_a?(Array)
166
+ self.links = value
167
+ end
168
+ end
169
+
170
+ if attributes.has_key?(:'Alignment')
171
+ self.alignment = attributes[:'Alignment']
172
+ end
173
+
174
+ if attributes.has_key?(:'HorizontalAlignment')
175
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
176
+ end
177
+
178
+ if attributes.has_key?(:'VerticalAlignment')
179
+ self.vertical_alignment = attributes[:'VerticalAlignment']
180
+ end
181
+
182
+ if attributes.has_key?(:'Top')
183
+ self.top = attributes[:'Top']
184
+ end
185
+
186
+ if attributes.has_key?(:'Left')
187
+ self.left = attributes[:'Left']
188
+ end
189
+
190
+ if attributes.has_key?(:'DefaultCellTextState')
191
+ self.default_cell_text_state = attributes[:'DefaultCellTextState']
192
+ end
193
+
194
+ if attributes.has_key?(:'DefaultCellPadding')
195
+ self.default_cell_padding = attributes[:'DefaultCellPadding']
196
+ end
197
+
198
+ if attributes.has_key?(:'Border')
199
+ self.border = attributes[:'Border']
200
+ end
201
+
202
+ if attributes.has_key?(:'Rows')
203
+ if (value = attributes[:'Rows']).is_a?(Array)
204
+ self.rows = value
205
+ end
206
+ end
207
+
208
+ if attributes.has_key?(:'DefaultColumnWidth')
209
+ self.default_column_width = attributes[:'DefaultColumnWidth']
210
+ end
211
+
212
+ if attributes.has_key?(:'DefaultCellBorder')
213
+ self.default_cell_border = attributes[:'DefaultCellBorder']
214
+ end
215
+
216
+ if attributes.has_key?(:'Broken')
217
+ self.broken = attributes[:'Broken']
218
+ end
219
+
220
+ if attributes.has_key?(:'ColumnWidths')
221
+ self.column_widths = attributes[:'ColumnWidths']
222
+ end
223
+
224
+ if attributes.has_key?(:'RepeatingRowsCount')
225
+ self.repeating_rows_count = attributes[:'RepeatingRowsCount']
226
+ end
227
+
228
+ if attributes.has_key?(:'RepeatingColumnsCount')
229
+ self.repeating_columns_count = attributes[:'RepeatingColumnsCount']
230
+ end
231
+
232
+ if attributes.has_key?(:'RepeatingRowsStyle')
233
+ self.repeating_rows_style = attributes[:'RepeatingRowsStyle']
234
+ end
235
+
236
+ if attributes.has_key?(:'CornerStyle')
237
+ self.corner_style = attributes[:'CornerStyle']
238
+ end
239
+
240
+ if attributes.has_key?(:'BreakText')
241
+ self.break_text = attributes[:'BreakText']
242
+ end
243
+
244
+ if attributes.has_key?(:'BackgroundColor')
245
+ self.background_color = attributes[:'BackgroundColor']
246
+ end
247
+
248
+ if attributes.has_key?(:'IsBordersIncluded')
249
+ self.is_borders_included = attributes[:'IsBordersIncluded']
250
+ end
251
+
252
+ if attributes.has_key?(:'ColumnAdjustment')
253
+ self.column_adjustment = attributes[:'ColumnAdjustment']
254
+ end
255
+
256
+ if attributes.has_key?(:'ZIndex')
257
+ self.z_index = attributes[:'ZIndex']
258
+ end
259
+
260
+ end
261
+
262
+ # Show invalid properties with the reasons. Usually used together with valid?
263
+ # @return Array for valid properies with the reasons
264
+ def list_invalid_properties
265
+ invalid_properties = Array.new
266
+ return invalid_properties
267
+ end
268
+
269
+ # Check to see if the all the properties in the model are valid
270
+ # @return true if the model is valid
271
+ def valid?
272
+ return true
273
+ end
274
+
275
+ # Checks equality by comparing each attribute.
276
+ # @param [Object] Object to be compared
277
+ def ==(o)
278
+ return true if self.equal?(o)
279
+ self.class == o.class &&
280
+ links == o.links &&
281
+ alignment == o.alignment &&
282
+ horizontal_alignment == o.horizontal_alignment &&
283
+ vertical_alignment == o.vertical_alignment &&
284
+ top == o.top &&
285
+ left == o.left &&
286
+ default_cell_text_state == o.default_cell_text_state &&
287
+ default_cell_padding == o.default_cell_padding &&
288
+ border == o.border &&
289
+ rows == o.rows &&
290
+ default_column_width == o.default_column_width &&
291
+ default_cell_border == o.default_cell_border &&
292
+ broken == o.broken &&
293
+ column_widths == o.column_widths &&
294
+ repeating_rows_count == o.repeating_rows_count &&
295
+ repeating_columns_count == o.repeating_columns_count &&
296
+ repeating_rows_style == o.repeating_rows_style &&
297
+ corner_style == o.corner_style &&
298
+ break_text == o.break_text &&
299
+ background_color == o.background_color &&
300
+ is_borders_included == o.is_borders_included &&
301
+ column_adjustment == o.column_adjustment &&
302
+ z_index == o.z_index
303
+ end
304
+
305
+ # @see the `==` method
306
+ # @param [Object] Object to be compared
307
+ def eql?(o)
308
+ self == o
309
+ end
310
+
311
+ # Calculates hash code according to all attributes.
312
+ # @return [Fixnum] Hash code
313
+ def hash
314
+ [links, alignment, horizontal_alignment, vertical_alignment, top, left, default_cell_text_state, default_cell_padding, border, rows, default_column_width, default_cell_border, broken, column_widths, repeating_rows_count, repeating_columns_count, repeating_rows_style, corner_style, break_text, background_color, is_borders_included, column_adjustment, z_index].hash
315
+ end
316
+
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def build_from_hash(attributes)
321
+ return nil unless attributes.is_a?(Hash)
322
+ self.class.swagger_types.each_pair do |key, type|
323
+ if type =~ /\AArray<(.*)>/i
324
+ # check to ensure the input is an array given that the the attribute
325
+ # is documented as an array but the input is not
326
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
327
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
328
+ end
329
+ elsif !attributes[self.class.attribute_map[key]].nil?
330
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
331
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
332
+ end
333
+
334
+ self
335
+ end
336
+
337
+ # Deserializes the data based on type
338
+ # @param string type Data type
339
+ # @param string value Value to be deserialized
340
+ # @return [Object] Deserialized data
341
+ def _deserialize(type, value)
342
+ case type.to_sym
343
+ when :DateTime
344
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
345
+ Time.strptime(value, format).utc.to_datetime
346
+ when :Date
347
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
348
+ Time.strptime(value, format).utc.to_datetime.to_date
349
+ when :String
350
+ value.to_s
351
+ when :Integer
352
+ value.to_i
353
+ when :Float
354
+ value.to_f
355
+ when :BOOLEAN
356
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
357
+ true
358
+ else
359
+ false
360
+ end
361
+ when :Object
362
+ # generic object (usually a Hash), return directly
363
+ value
364
+ when /\AArray<(?<inner_type>.+)>\z/
365
+ inner_type = Regexp.last_match[:inner_type]
366
+ value.map { |v| _deserialize(inner_type, v) }
367
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
368
+ k_type = Regexp.last_match[:k_type]
369
+ v_type = Regexp.last_match[:v_type]
370
+ {}.tap do |hash|
371
+ value.each do |k, v|
372
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
373
+ end
374
+ end
375
+ else # model
376
+ temp_model = AsposePdfCloud.const_get(type).new
377
+ temp_model.build_from_hash(value)
378
+ end
379
+ end
380
+
381
+ # Returns the string representation of the object
382
+ # @return [String] String presentation of the object
383
+ def to_s
384
+ to_hash.to_s
385
+ end
386
+
387
+ # to_body is an alias to to_hash (backward compatibility)
388
+ # @return [Hash] Returns the object in the form of hash
389
+ def to_body
390
+ to_hash
391
+ end
392
+
393
+ # Returns the object in the form of hash
394
+ # @return [Hash] Returns the object in the form of hash
395
+ def to_hash
396
+ hash = {}
397
+ self.class.attribute_map.each_pair do |attr, param|
398
+ value = self.send(attr)
399
+ next if value.nil?
400
+ hash[param] = _to_hash(value)
401
+ end
402
+ hash
403
+ end
404
+
405
+ # Outputs non-array value in the form of hash
406
+ # For object, use to_hash. Otherwise, just return the value
407
+ # @param [Object] value Any valid value
408
+ # @return [Hash] Returns the value in the form of hash
409
+ def _to_hash(value)
410
+ if value.is_a?(Array)
411
+ value.compact.map{ |v| _to_hash(v) }
412
+ elsif value.is_a?(Hash)
413
+ {}.tap do |hash|
414
+ value.each { |k, v| hash[k] = _to_hash(v) }
415
+ end
416
+ elsif value.respond_to? :to_hash
417
+ value.to_hash
418
+ else
419
+ value
420
+ end
421
+ end
422
+
423
+ end
424
+
425
+ end
@@ -0,0 +1,45 @@
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
+ class TableBroken
27
+
28
+ NONE = "None".freeze
29
+ VERTICAL = "Vertical".freeze
30
+ VERTICAL_IN_SAME_PAGE = "VerticalInSamePage".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 = TableBroken.constants.select{|c| c.to_s == value}
38
+ constantValues = TableBroken.constants.select{ |const_name| TableBroken.const_get(const_name) == value}
39
+
40
+ raise "Invalid ENUM value #{value} for class #TableBroken" if constantValues.empty?
41
+ value
42
+ end
43
+ end
44
+
45
+ end