aspose_pdf_cloud 20.5.0 → 20.12.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 +13 -8
  3. data/docs/ApiInfo.md +10 -0
  4. data/docs/CheckBoxField.md +1 -0
  5. data/docs/ChoiceField.md +1 -0
  6. data/docs/ComboBoxField.md +1 -0
  7. data/docs/FormField.md +1 -0
  8. data/docs/ImageCompressionVersion.md +12 -0
  9. data/docs/ImageEncoding.md +13 -0
  10. data/docs/ListBoxField.md +1 -0
  11. data/docs/OptimizeOptions.md +13 -7
  12. data/docs/OutputFormat.md +11 -0
  13. data/docs/Paragraph.md +2 -2
  14. data/docs/PdfAType.md +3 -2
  15. data/docs/PdfApi.md +36 -12
  16. data/docs/RadioButtonField.md +1 -0
  17. data/docs/RadioButtonOptionField.md +1 -0
  18. data/docs/RedactionAnnotation.md +1 -1
  19. data/docs/SignatureCustomAppearance.md +1 -1
  20. data/docs/SignatureField.md +1 -0
  21. data/docs/TextBoxField.md +1 -0
  22. data/docs/TextState.md +2 -1
  23. data/docs/TextStyle.md +1 -0
  24. data/lib/aspose_pdf_cloud.rb +4 -0
  25. data/lib/aspose_pdf_cloud/api/pdf_api.rb +100 -22
  26. data/lib/aspose_pdf_cloud/models/api_info.rb +209 -0
  27. data/lib/aspose_pdf_cloud/models/check_box_field.rb +11 -1
  28. data/lib/aspose_pdf_cloud/models/choice_field.rb +11 -1
  29. data/lib/aspose_pdf_cloud/models/combo_box_field.rb +11 -1
  30. data/lib/aspose_pdf_cloud/models/form_field.rb +11 -1
  31. data/lib/aspose_pdf_cloud/models/image_compression_version.rb +45 -0
  32. data/lib/aspose_pdf_cloud/models/image_encoding.rb +46 -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/paragraph.rb +2 -2
  37. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +1 -0
  38. data/lib/aspose_pdf_cloud/models/radio_button_field.rb +11 -1
  39. data/lib/aspose_pdf_cloud/models/radio_button_option_field.rb +11 -1
  40. data/lib/aspose_pdf_cloud/models/redaction_annotation.rb +1 -1
  41. data/lib/aspose_pdf_cloud/models/signature_custom_appearance.rb +1 -1
  42. data/lib/aspose_pdf_cloud/models/signature_field.rb +11 -1
  43. data/lib/aspose_pdf_cloud/models/text_box_field.rb +11 -1
  44. data/lib/aspose_pdf_cloud/models/text_state.rb +15 -5
  45. data/lib/aspose_pdf_cloud/models/text_style.rb +14 -4
  46. data/lib/aspose_pdf_cloud/version.rb +1 -1
  47. data/test/pdf_tests.rb +8 -4
  48. data/test_data/Righteous-Regular.ttf +0 -0
  49. metadata +11 -2
@@ -0,0 +1,44 @@
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 OutputFormat
27
+
28
+ ZIP = "Zip".freeze
29
+ FOLDER = "Folder".freeze
30
+
31
+ # Builds the enum from string
32
+ # @param [String] The enum value in the form of the string
33
+ # @return [String] The enum value
34
+ def build_from_hash(value)
35
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
36
+ # consantValues = OutputFormat.constants.select{|c| c.to_s == value}
37
+ constantValues = OutputFormat.constants.select{ |const_name| OutputFormat.const_get(const_name) == value}
38
+
39
+ raise "Invalid ENUM value #{value} for class #OutputFormat" if constantValues.empty?
40
+ value
41
+ end
42
+ end
43
+
44
+ end
@@ -31,7 +31,7 @@ module AsposePdfCloud
31
31
  # Word wrap mode.
32
32
  attr_accessor :wrap_mode
33
33
 
34
- # Horizontal alignment for the text inside paragrph's rectangle.
34
+ # Horizontal alignment for the text inside paragraph's rectangle.
35
35
  attr_accessor :horizontal_alignment
36
36
 
37
37
  # Left margin.
@@ -55,7 +55,7 @@ module AsposePdfCloud
55
55
  # Subsequent lines indent value.
56
56
  attr_accessor :subsequent_lines_indent
57
57
 
58
- # Vertical alignment for the text inside paragrph's rectangle
58
+ # Vertical alignment for the text inside paragraph's rectangle
59
59
  attr_accessor :vertical_alignment
60
60
 
61
61
  # An array of text lines.
@@ -27,6 +27,7 @@ module AsposePdfCloud
27
27
 
28
28
  PDFA1_A = "PDFA1A".freeze
29
29
  PDFA1_B = "PDFA1B".freeze
30
+ PDFA3_A = "PDFA3A".freeze
30
31
 
31
32
  # Builds the enum from string
32
33
  # @param [String] The enum value in the form of the string
@@ -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
 
@@ -103,6 +106,7 @@ module AsposePdfCloud
103
106
  {
104
107
  :'links' => :'Links',
105
108
  :'partial_name' => :'PartialName',
109
+ :'full_name' => :'FullName',
106
110
  :'rect' => :'Rect',
107
111
  :'value' => :'Value',
108
112
  :'page_index' => :'PageIndex',
@@ -133,6 +137,7 @@ module AsposePdfCloud
133
137
  {
134
138
  :'links' => :'Array<Link>',
135
139
  :'partial_name' => :'String',
140
+ :'full_name' => :'String',
136
141
  :'rect' => :'Rectangle',
137
142
  :'value' => :'String',
138
143
  :'page_index' => :'Integer',
@@ -176,6 +181,10 @@ module AsposePdfCloud
176
181
  self.partial_name = attributes[:'PartialName']
177
182
  end
178
183
 
184
+ if attributes.has_key?(:'FullName')
185
+ self.full_name = attributes[:'FullName']
186
+ end
187
+
179
188
  if attributes.has_key?(:'Rect')
180
189
  self.rect = attributes[:'Rect']
181
190
  end
@@ -297,6 +306,7 @@ module AsposePdfCloud
297
306
  self.class == o.class &&
298
307
  links == o.links &&
299
308
  partial_name == o.partial_name &&
309
+ full_name == o.full_name &&
300
310
  rect == o.rect &&
301
311
  value == o.value &&
302
312
  page_index == o.page_index &&
@@ -330,7 +340,7 @@ module AsposePdfCloud
330
340
  # Calculates hash code according to all attributes.
331
341
  # @return [Fixnum] Hash code
332
342
  def hash
333
- [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, radio_button_options_field, style].hash
343
+ [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, radio_button_options_field, style].hash
334
344
  end
335
345
 
336
346
  # Builds the object from hash
@@ -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
 
@@ -94,6 +97,7 @@ module AsposePdfCloud
94
97
  {
95
98
  :'links' => :'Links',
96
99
  :'partial_name' => :'PartialName',
100
+ :'full_name' => :'FullName',
97
101
  :'rect' => :'Rect',
98
102
  :'value' => :'Value',
99
103
  :'page_index' => :'PageIndex',
@@ -121,6 +125,7 @@ module AsposePdfCloud
121
125
  {
122
126
  :'links' => :'Array<Link>',
123
127
  :'partial_name' => :'String',
128
+ :'full_name' => :'String',
124
129
  :'rect' => :'Rectangle',
125
130
  :'value' => :'String',
126
131
  :'page_index' => :'Integer',
@@ -161,6 +166,10 @@ module AsposePdfCloud
161
166
  self.partial_name = attributes[:'PartialName']
162
167
  end
163
168
 
169
+ if attributes.has_key?(:'FullName')
170
+ self.full_name = attributes[:'FullName']
171
+ end
172
+
164
173
  if attributes.has_key?(:'Rect')
165
174
  self.rect = attributes[:'Rect']
166
175
  end
@@ -266,6 +275,7 @@ module AsposePdfCloud
266
275
  self.class == o.class &&
267
276
  links == o.links &&
268
277
  partial_name == o.partial_name &&
278
+ full_name == o.full_name &&
269
279
  rect == o.rect &&
270
280
  value == o.value &&
271
281
  page_index == o.page_index &&
@@ -296,7 +306,7 @@ module AsposePdfCloud
296
306
  # Calculates hash code according to all attributes.
297
307
  # @return [Fixnum] Hash code
298
308
  def hash
299
- [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, option_name, style].hash
309
+ [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, option_name, style].hash
300
310
  end
301
311
 
302
312
  # Builds the object from hash
@@ -73,7 +73,7 @@ module AsposePdfCloud
73
73
  # Text to print on redact annotation.
74
74
  attr_accessor :overlay_text
75
75
 
76
- # If true overlay text will be repated on the annotation.
76
+ # If true overlay text will be repeated on the annotation.
77
77
  attr_accessor :repeat
78
78
 
79
79
  # Gets or sets. Alignment of Overlay Text.
@@ -23,7 +23,7 @@ require 'date'
23
23
  require 'time'
24
24
 
25
25
  module AsposePdfCloud
26
- # An abstract class which represents signature custon appearance object.
26
+ # An abstract class which represents signature custom appearance object.
27
27
  class SignatureCustomAppearance
28
28
  # Gets/sets font family name. It should be existed in the document. Default value: Arial.
29
29
  attr_accessor :font_family_name
@@ -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
 
@@ -91,6 +94,7 @@ module AsposePdfCloud
91
94
  {
92
95
  :'links' => :'Links',
93
96
  :'partial_name' => :'PartialName',
97
+ :'full_name' => :'FullName',
94
98
  :'rect' => :'Rect',
95
99
  :'value' => :'Value',
96
100
  :'page_index' => :'PageIndex',
@@ -117,6 +121,7 @@ module AsposePdfCloud
117
121
  {
118
122
  :'links' => :'Array<Link>',
119
123
  :'partial_name' => :'String',
124
+ :'full_name' => :'String',
120
125
  :'rect' => :'Rectangle',
121
126
  :'value' => :'String',
122
127
  :'page_index' => :'Integer',
@@ -156,6 +161,10 @@ module AsposePdfCloud
156
161
  self.partial_name = attributes[:'PartialName']
157
162
  end
158
163
 
164
+ if attributes.has_key?(:'FullName')
165
+ self.full_name = attributes[:'FullName']
166
+ end
167
+
159
168
  if attributes.has_key?(:'Rect')
160
169
  self.rect = attributes[:'Rect']
161
170
  end
@@ -257,6 +266,7 @@ module AsposePdfCloud
257
266
  self.class == o.class &&
258
267
  links == o.links &&
259
268
  partial_name == o.partial_name &&
269
+ full_name == o.full_name &&
260
270
  rect == o.rect &&
261
271
  value == o.value &&
262
272
  page_index == o.page_index &&
@@ -286,7 +296,7 @@ module AsposePdfCloud
286
296
  # Calculates hash code according to all attributes.
287
297
  # @return [Fixnum] Hash code
288
298
  def hash
289
- [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, signature].hash
299
+ [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, signature].hash
290
300
  end
291
301
 
292
302
  # Builds the object from hash
@@ -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
@@ -302,6 +311,7 @@ module AsposePdfCloud
302
311
  self.class == o.class &&
303
312
  links == o.links &&
304
313
  partial_name == o.partial_name &&
314
+ full_name == o.full_name &&
305
315
  rect == o.rect &&
306
316
  value == o.value &&
307
317
  page_index == o.page_index &&
@@ -336,7 +346,7 @@ module AsposePdfCloud
336
346
  # Calculates hash code according to all attributes.
337
347
  # @return [Fixnum] Hash code
338
348
  def hash
339
- [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, multiline, spell_check, scrollable, force_combs, max_len, barcode].hash
349
+ [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, multiline, spell_check, scrollable, force_combs, max_len, barcode].hash
340
350
  end
341
351
 
342
352
  # Builds the object from hash
@@ -28,7 +28,7 @@ module AsposePdfCloud
28
28
  # Gets or sets font size of the text.
29
29
  attr_accessor :font_size
30
30
 
31
- # Gets or sets font of the text.
31
+ # Gets or sets font name of the text.
32
32
  attr_accessor :font
33
33
 
34
34
  # Gets or sets foreground color of the text.
@@ -40,6 +40,9 @@ module AsposePdfCloud
40
40
  # Sets font style of the text.
41
41
  attr_accessor :font_style
42
42
 
43
+ # Sets path of font file in storage.
44
+ attr_accessor :font_file
45
+
43
46
 
44
47
  # Attribute mapping from ruby-style variable name to JSON key.
45
48
  def self.attribute_map
@@ -48,7 +51,8 @@ module AsposePdfCloud
48
51
  :'font' => :'Font',
49
52
  :'foreground_color' => :'ForegroundColor',
50
53
  :'background_color' => :'BackgroundColor',
51
- :'font_style' => :'FontStyle'
54
+ :'font_style' => :'FontStyle',
55
+ :'font_file' => :'FontFile'
52
56
  }
53
57
  end
54
58
 
@@ -59,7 +63,8 @@ module AsposePdfCloud
59
63
  :'font' => :'String',
60
64
  :'foreground_color' => :'Color',
61
65
  :'background_color' => :'Color',
62
- :'font_style' => :'FontStyles'
66
+ :'font_style' => :'FontStyles',
67
+ :'font_file' => :'String'
63
68
  }
64
69
  end
65
70
 
@@ -91,6 +96,10 @@ module AsposePdfCloud
91
96
  self.font_style = attributes[:'FontStyle']
92
97
  end
93
98
 
99
+ if attributes.has_key?(:'FontFile')
100
+ self.font_file = attributes[:'FontFile']
101
+ end
102
+
94
103
  end
95
104
 
96
105
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -125,7 +134,8 @@ module AsposePdfCloud
125
134
  font == o.font &&
126
135
  foreground_color == o.foreground_color &&
127
136
  background_color == o.background_color &&
128
- font_style == o.font_style
137
+ font_style == o.font_style &&
138
+ font_file == o.font_file
129
139
  end
130
140
 
131
141
  # @see the `==` method
@@ -137,7 +147,7 @@ module AsposePdfCloud
137
147
  # Calculates hash code according to all attributes.
138
148
  # @return [Fixnum] Hash code
139
149
  def hash
140
- [font_size, font, foreground_color, background_color, font_style].hash
150
+ [font_size, font, foreground_color, background_color, font_style, font_file].hash
141
151
  end
142
152
 
143
153
  # Builds the object from hash
@@ -37,6 +37,9 @@ module AsposePdfCloud
37
37
  # Sets background color of the text.
38
38
  attr_accessor :background_color
39
39
 
40
+ # Sets path of font file in storage.
41
+ attr_accessor :font_file
42
+
40
43
 
41
44
  # Attribute mapping from ruby-style variable name to JSON key.
42
45
  def self.attribute_map
@@ -44,7 +47,8 @@ module AsposePdfCloud
44
47
  :'font_size' => :'FontSize',
45
48
  :'font' => :'Font',
46
49
  :'foreground_color' => :'ForegroundColor',
47
- :'background_color' => :'BackgroundColor'
50
+ :'background_color' => :'BackgroundColor',
51
+ :'font_file' => :'FontFile'
48
52
  }
49
53
  end
50
54
 
@@ -54,7 +58,8 @@ module AsposePdfCloud
54
58
  :'font_size' => :'Float',
55
59
  :'font' => :'String',
56
60
  :'foreground_color' => :'Color',
57
- :'background_color' => :'Color'
61
+ :'background_color' => :'Color',
62
+ :'font_file' => :'String'
58
63
  }
59
64
  end
60
65
 
@@ -82,6 +87,10 @@ module AsposePdfCloud
82
87
  self.background_color = attributes[:'BackgroundColor']
83
88
  end
84
89
 
90
+ if attributes.has_key?(:'FontFile')
91
+ self.font_file = attributes[:'FontFile']
92
+ end
93
+
85
94
  end
86
95
 
87
96
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -110,7 +119,8 @@ module AsposePdfCloud
110
119
  font_size == o.font_size &&
111
120
  font == o.font &&
112
121
  foreground_color == o.foreground_color &&
113
- background_color == o.background_color
122
+ background_color == o.background_color &&
123
+ font_file == o.font_file
114
124
  end
115
125
 
116
126
  # @see the `==` method
@@ -122,7 +132,7 @@ module AsposePdfCloud
122
132
  # Calculates hash code according to all attributes.
123
133
  # @return [Fixnum] Hash code
124
134
  def hash
125
- [font_size, font, foreground_color, background_color].hash
135
+ [font_size, font, foreground_color, background_color, font_file].hash
126
136
  end
127
137
 
128
138
  # Builds the object from hash
@@ -20,5 +20,5 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  module AsposePdfCloud
23
- VERSION = "20.5.0"
23
+ VERSION = "20.12.0"
24
24
  end
@@ -3050,10 +3050,11 @@ class PdfTests < Minitest::Test
3050
3050
  def test_put_pdf_in_storage_to_html
3051
3051
  file_name = '4pages.pdf'
3052
3052
  upload_file(file_name)
3053
- res_file = 'result.zip'
3053
+ res_file = 'result_4pages.html'
3054
3054
 
3055
3055
  opts = {
3056
- :folder => @temp_folder
3056
+ :folder => @temp_folder,
3057
+ :output_format => OutputFormat::FOLDER
3057
3058
  }
3058
3059
  response = @pdf_api.put_pdf_in_storage_to_html(file_name, @temp_folder + '/' + res_file, opts)
3059
3060
  assert(response, 'Filed to convert PDF to HTML.')
@@ -5874,6 +5875,8 @@ class PdfTests < Minitest::Test
5874
5875
  def test_put_add_text
5875
5876
  file_name = '4pages.pdf'
5876
5877
  upload_file(file_name)
5878
+ font_name = 'Righteous-Regular.ttf'
5879
+ upload_file(font_name)
5877
5880
 
5878
5881
  page_number = 1
5879
5882
 
@@ -5896,11 +5899,12 @@ class PdfTests < Minitest::Test
5896
5899
  background_color.b = 0x00
5897
5900
 
5898
5901
  text_state = TextState.new
5899
- text_state.font = 'Arial'
5902
+ text_state.font = 'Righteous'
5900
5903
  text_state.font_size = 10
5901
5904
  text_state.foreground_color = foreground_color
5902
5905
  text_state.background_color = background_color
5903
- text_state.font_style = FontStyles::BOLD
5906
+ text_state.font_style = FontStyles::REGULAR
5907
+ text_state.font_file = @temp_folder + '/' + font_name
5904
5908
 
5905
5909
  segment = Segment.new
5906
5910
  segment.value = 'segment 1'