aspose_html_cloud 22.10.2 → 22.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7135c0c7df6333484c04dea4f15aa948f4a4988015eee7cbac931941ffe8fb6a
4
- data.tar.gz: 96dfb00ce014ab9b3ac72f170f4b8f6629cef2314fe78a811b7e56e8eb3022b7
3
+ metadata.gz: a927f766c44d069be1fa647614ed0ba4df757135ba36df1ab5fd03f44ada11e2
4
+ data.tar.gz: 5ed40aeaedfb53018f57e6a4b8ebc70e299caddb5f7ebf98bb012f3aa2aaca5e
5
5
  SHA512:
6
- metadata.gz: 7d1a073130cb87d6b26b1e72646adc7f2d012f080df138235f95cbb01cfcbce254c5312844f622780542caab750c7e1df591dc235ac539b342b6574bb132e994
7
- data.tar.gz: aa892430a7b25fa79b7d0f6de6aa44adc8c50b4e6c9cff499d4d0682816b341c0097440813c66e01c735ebbd2ecd5c3d63314251cca9953bff72ad1bcfb2f4f6
6
+ metadata.gz: af3da353d85ddcad122665d921ce8ea46a5ab01f90062721d2794c7b61f1f503ae1ec4269d94a73ce4f08670f7f18d6d7a083eff92f9dcac04d90510fa6f8672
7
+ data.tar.gz: 05b35cfe4175def4f7e3de35dbbb7f85607b93ac3f227f0fed129aa0f09d404f5f94026d216e7e86c580a53e78dafc10514fcfa51a5b6808ccc946efeb016c6c
@@ -39,69 +39,69 @@ module AsposeHtml
39
39
  end
40
40
 
41
41
 
42
- # Converting the HTML, EPUB document from the local file and putting the result in the local file
42
+ # Converting a document from the local file and putting the result in the local file
43
43
  #
44
44
  # @param src Full path to source file.
45
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
45
+ # @param dst Full path to a result file.
46
46
  # @param [Hash, nil] options the optional parameters
47
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
48
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
49
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
50
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
51
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
52
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
53
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
47
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
48
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
49
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
50
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
51
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
52
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
53
+ # @return [OperationResult] Result of operation. See OperationResult object.
54
54
  def convert_local_to_local(src, dst, options = nil)
55
55
  convert(src, dst, true, true, false, options)
56
56
  end
57
57
 
58
- # Converting the HTML, EPUB document from the local file and putting the result in the storage
58
+ # Converting a document from the local file and putting the result in the storage
59
59
  #
60
60
  # @param src Full path to source file.
61
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
61
+ # @param dst Full path to a result file.
62
62
  # @param storage Storage name. Default storage is nil.
63
63
  # @param [Hash, nil] options the optional parameters
64
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
65
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
66
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
67
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
68
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
69
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
70
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
64
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
65
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
66
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
67
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
68
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
69
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
70
+ # @return [OperationResult] Result of operation. See OperationResult object.
71
71
  def convert_local_to_storage(src, dst, storage, options=nil)
72
72
  convert(src, dst, true, false, false, options, storage)
73
73
  end
74
74
 
75
- # Converting the HTML, EPUB document from the storage and putting the result in the local file
75
+ # Converting a document from the storage and putting the result in the local file
76
76
  #
77
77
  # @param src Full path to source file.
78
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
78
+ # @param dst Full path to a result file.
79
79
  # @param storage Storage name. Default storage is nil.
80
80
  # @param [Hash, nil] options the optional parameters
81
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
82
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
83
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
84
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
85
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
86
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
87
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
81
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
82
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
83
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
84
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
85
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
86
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
87
+ # @return [OperationResult] Result of operation. See OperationResult object.
88
88
  def convert_storage_to_local(src, dst, storage, options=nil)
89
89
  convert(src, dst, false, true, false, options, storage)
90
90
  end
91
91
 
92
- # Converting the HTML, EPUB document from the storage and putting the result in the storage
92
+ # Converting a document from the storage and putting the result in the storage
93
93
  #
94
94
  # @param src Full path to source file.
95
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
95
+ # @param dst Full path to a result file.
96
96
  # @param storage Storage name. Default storage is nil.
97
97
  # @param [Hash, nil] options the optional parameters
98
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
99
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
100
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
101
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
102
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
103
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
104
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
98
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
99
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
100
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
101
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
102
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
103
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
104
+ # @return [OperationResult] Result of operation. See OperationResult object.
105
105
  def convert_storage_to_storage(src, dst, storage, options=nil)
106
106
  convert(src, dst, false, false, false, options, storage)
107
107
  end
@@ -109,15 +109,15 @@ module AsposeHtml
109
109
  # Converting the HTML page from URL and putting the result in the local file
110
110
  #
111
111
  # @param src URI of the website.
112
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
112
+ # @param dst Full path to a result file.
113
113
  # @param [Hash, nil] options the optional parameters
114
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
115
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
116
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
117
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
118
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
119
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
120
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
114
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
115
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
116
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
117
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
118
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
119
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
120
+ # @return [OperationResult] Result of operation. See OperationResult object.
121
121
  def convert_url_to_local(src, dst, options=nil)
122
122
  convert(src, dst, false, true, true, options)
123
123
  end
@@ -125,36 +125,117 @@ module AsposeHtml
125
125
  # Converting the HTML page from URL and putting the result in the storage
126
126
  #
127
127
  # @param src URI of the website.
128
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
128
+ # @param dst Full path to a result file.
129
129
  # @param storage Storage name. Default storage is nil.
130
130
  # @param [Hash, nil] options the optional parameters
131
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
132
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
133
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
134
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
135
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
136
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
137
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
131
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
132
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
133
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
134
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
135
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
136
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
137
+ # @return [OperationResult] Result of operation. See OperationResult object.
138
138
  def convert_url_to_storage(src, dst, storage, options=nil)
139
139
  convert(src, dst, false, false, true, options, storage)
140
140
  end
141
141
 
142
- # Converting the HTML document to various formats
142
+ # Vectorization an image from the local file and putting the result in the local file
143
+ #
144
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
145
+ # @param dst Full path to a result file (svg).
146
+ # @param [Hash, nil] options the optional parameters
147
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
148
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
149
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
150
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
151
+ # @return [OperationResult] Result of operation. See OperationResult object.
152
+ def vectorize_local_to_local(src, dst, options = nil)
153
+ vectorize(src, dst, true, true, options)
154
+ end
155
+
156
+ # Vectorization an image from the local file and putting the result in the storage
157
+ #
158
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
159
+ # @param dst Full path to a result file (svg).
160
+ # @param storage Storage name. Default storage is nil.
161
+ # @param [Hash, nil] options the optional parameters
162
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
163
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
164
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
165
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
166
+ # @return [OperationResult] Result of operation. See OperationResult object.
167
+ def vectorize_local_to_storage(src, dst, storage, options=nil)
168
+ vectorize(src, dst, true, false, options, storage)
169
+ end
170
+
171
+ # Vectorization an image from the storage and putting the result in the local file
172
+ #
173
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
174
+ # @param dst Full path to a result file (svg).
175
+ # @param storage Storage name. Default storage is nil.
176
+ # @param [Hash, nil] options the optional parameters
177
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
178
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
179
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
180
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
181
+ # @return [OperationResult] Result of operation. See OperationResult object.
182
+ def vectorize_storage_to_local(src, dst, storage, options=nil)
183
+ vectorize(src, dst, false, true, options, storage)
184
+ end
185
+
186
+ # Vectorization an image from the storage and putting the result in the storage
187
+ #
188
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
189
+ # @param dst Full path to a result file (svg).
190
+ # @param storage Storage name. Default storage is nil.
191
+ # @param [Hash, nil] options the optional parameters
192
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
193
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
194
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
195
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
196
+ # @return [OperationResult] Result of operation. See OperationResult object.
197
+ def vectorize_storage_to_storage(src, dst, storage, options=nil)
198
+ vectorize(src, dst, false, false, options, storage)
199
+ end
200
+
201
+ # Vectorization an image from to SVG format
202
+ #
203
+ # @param src Full path to source file(bmp, png, gif, tiff, jpeg).
204
+ # @param dst Full path to a result file (svg).
205
+ # @param src_in_local Flag, true if source in the local file.
206
+ # @param dst_in_local Flag, true if result in the local file.
207
+ # @param [Hash, nil] options the optional parameters
208
+ # @option options [Float] :error_threshold Defines maximum deviation of points to fitted curve. By default it is 30.
209
+ # @option options [Integer] :max_iterations Defines number of iteration for least-squares approximation method. By default, it is 30.
210
+ # @option options [Integer] :colors_limit The maximum number of colors used to quantize an image. Default value is 25.
211
+ # @option options [Float] :line_width The value of this parameter is affected by the graphics scale. Default value is 1.
212
+ # @param storage_name Storage name. Default storage is nil.
213
+ # @return [OperationResult] Result of operation. See OperationResult object.
214
+ def vectorize(src, dst, src_in_local, dst_in_local, options=nil, storage_name=nil)
215
+ input_format = get_input_format(src)
216
+ output_format = File.extname(dst).strip.downcase[1..-1]
217
+ fail ApiError.new('Input format must be bmp, jpeg, gif, tiff, png') unless %w[bmp jpeg gif tiff png].include? input_format
218
+ fail ApiError.new('Output format must be SVG') if output_format != 'svg'
219
+ convert(src, dst, src_in_local, dst_in_local, false, options, storage_name)
220
+ end
221
+
222
+
223
+ # Converting a document to various formats
143
224
  #
144
225
  # @param src Source file or URL.
145
- # @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
226
+ # @param dst Full path to a result file.
146
227
  # @param src_in_local Flag, true if source in the local file.
147
228
  # @param dst_in_local Flag, true if result in the local file.
148
229
  # @param is_url Flag, true if source is website.
149
230
  # @param [Hash, nil] options the optional parameters
150
- # @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
151
- # @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
152
- # @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
153
- # @option options [Double] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
154
- # @option options [Double] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
155
- # @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
231
+ # @option options [Float] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
232
+ # @option options [Float] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
233
+ # @option options [Float] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
234
+ # @option options [Float] :right_margin Right resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
235
+ # @option options [Float] :top_margin Top resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
236
+ # @option options [Float] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
156
237
  # @param storage_name Storage name. Default storage is nil.
157
- # @return [ConversionResult] Result of conversion. See ConversionResult object.
238
+ # @return [OperationResult] Result of operation. See OperationResult object.
158
239
  def convert(src, dst, src_in_local, dst_in_local, is_url, options=nil, storage_name=nil)
159
240
  if src_in_local
160
241
  res = @storage_api.upload_file("/", src)
@@ -198,6 +279,13 @@ module AsposeHtml
198
279
  post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?
199
280
  post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?
200
281
  post_body[:'options'][:'resolution'] = options[:'resolution'] unless options[:'resolution'].nil?
282
+ post_body[:'options'][:'background'] = options[:'background'] unless options[:'background'].nil?
283
+ post_body[:'options'][:'jpegquality'] = options[:'jpeg_quality'] unless options[:'jpeg_quality'].nil?
284
+ post_body[:'options'][:'usegit'] = options[:'use_git'] unless options[:'use_git'].nil?
285
+ post_body[:'options'][:'error_threshold'] = options[:'error_threshold'] unless options[:'error_threshold'].nil?
286
+ post_body[:'options'][:'max_iterations'] = options[:'max_iterations'] unless options[:'max_iterations'].nil?
287
+ post_body[:'options'][:'colors_limit'] = options[:'colors_limit'] unless options[:'colors_limit'].nil?
288
+ post_body[:'options'][:'line_width'] = options[:'line_width'] unless options[:'line_width'].nil?
201
289
  end
202
290
 
203
291
  query_params = {}
@@ -217,7 +305,7 @@ module AsposeHtml
217
305
  :query_params => query_params,
218
306
  :form_params => form_params,
219
307
  :body => post_body,
220
- :return_type => 'ConversionResult')
308
+ :return_type => 'OperationResult')
221
309
  if @api_client.config.debug
222
310
  @api_client.config.logger.debug "API called: Create task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
223
311
  end
@@ -263,27 +351,25 @@ module AsposeHtml
263
351
  :query_params => query_params,
264
352
  :form_params => form_params,
265
353
  :body => post_body,
266
- :return_type => 'ConversionResult')
354
+ :return_type => 'OperationResult')
267
355
 
268
356
  end
269
357
 
270
358
  def get_input_format(path)
271
- ext = File.extname(path).upcase
359
+ ext = File.extname(path).downcase[1..-1]
272
360
  case ext
273
- when '.HTML', '.HTM'
361
+ when 'htm'
274
362
  return 'html'
275
- when '.MHT', '.MHTML'
363
+ when 'mht'
276
364
  return 'mhtml'
277
- when '.XHTML', '.XML'
365
+ when 'xml'
278
366
  return 'xhtml'
279
- when '.EPUB'
280
- return 'epub'
281
- when '.SVG'
282
- return 'svg'
283
- when '.MD'
284
- return 'md'
367
+ when 'jpg'
368
+ return 'jpeg'
369
+ when 'tif'
370
+ return 'tiff'
285
371
  else
286
- return nil
372
+ ext
287
373
  end
288
374
  end
289
375
 
@@ -58,7 +58,7 @@ module AsposeHtml
58
58
  @api_client.config.logger.debug 'Calling API: StorageApi.get_disc_usage ...'
59
59
  end
60
60
  # resource path
61
- local_var_path = '/html/storage/disc'
61
+ local_var_path = '/html/storage/disc/usage'
62
62
 
63
63
  # query parameters
64
64
  query_params = {}
@@ -57,7 +57,7 @@ module AsposeHtml
57
57
  'User-Agent' => @user_agent,
58
58
  'Authorization' => "Bearer #{@config.access_token}",
59
59
  'x-aspose-client' => "aspose.html-cloud ruby sdk",
60
- 'x-aspose-client-version' => "22.10.2"
60
+ 'x-aspose-client-version' => "22.12.1"
61
61
  }
62
62
  end
63
63
 
@@ -29,7 +29,7 @@
29
29
  require_relative 'base_model'
30
30
 
31
31
  module AsposeHtml
32
- class ConversionResult < BaseModel
32
+ class OperationResult < BaseModel
33
33
  attr_accessor :code
34
34
 
35
35
  attr_accessor :id
@@ -49,7 +49,7 @@ require 'aspose_html_cloud/models/files_upload_result'
49
49
  require 'aspose_html_cloud/models/object_exist'
50
50
  require 'aspose_html_cloud/models/storage_exist'
51
51
  require 'aspose_html_cloud/models/storage_file'
52
- require 'aspose_html_cloud/models/conversion_result'
52
+ require 'aspose_html_cloud/models/operation_result'
53
53
 
54
54
  module AsposeHtml
55
55
  class << self
@@ -120,7 +120,7 @@ describe 'Test html_api_V4' do
120
120
 
121
121
  expect(answer.code).to eql(200)
122
122
  expect(answer.status).to eql('completed')
123
- expect(@storage_api.object_exists(answer.file)).to be_truthy
123
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
124
124
  end
125
125
  }
126
126
  end
@@ -135,7 +135,7 @@ describe 'Test html_api_V4' do
135
135
 
136
136
  expect(answer.code).to eql(200)
137
137
  expect(answer.status).to eql('completed')
138
- expect(@storage_api.object_exists(answer.file)).to be_truthy
138
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
139
139
  end
140
140
  }
141
141
  end
@@ -159,7 +159,7 @@ describe 'Test html_api_V4' do
159
159
 
160
160
  expect(answer.code).to eql(200)
161
161
  expect(answer.status).to eql('completed')
162
- expect(@storage_api.object_exists(answer.file)).to be_truthy
162
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
163
163
  end
164
164
  }
165
165
  end
@@ -248,7 +248,7 @@ describe 'Test html_api_V4' do
248
248
 
249
249
  expect(answer.code).to eql(200)
250
250
  expect(answer.status).to eql('completed')
251
- expect(@storage_api.object_exists(answer.file)).to be_truthy
251
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
252
252
  end
253
253
  }
254
254
  end
@@ -263,7 +263,7 @@ describe 'Test html_api_V4' do
263
263
 
264
264
  expect(answer.code).to eql(200)
265
265
  expect(answer.status).to eql('completed')
266
- expect(@storage_api.object_exists(answer.file)).to be_truthy
266
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
267
267
  end
268
268
  }
269
269
  end
@@ -287,7 +287,7 @@ describe 'Test html_api_V4' do
287
287
 
288
288
  expect(answer.code).to eql(200)
289
289
  expect(answer.status).to eql('completed')
290
- expect(@storage_api.object_exists(answer.file)).to be_truthy
290
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
291
291
  end
292
292
  }
293
293
  end
@@ -367,7 +367,7 @@ describe 'Test html_api_V4' do
367
367
 
368
368
  expect(answer.code).to eql(200)
369
369
  expect(answer.status).to eql('completed')
370
- expect(@storage_api.object_exists(answer.file)).to be_truthy
370
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
371
371
  end
372
372
  }
373
373
  end
@@ -382,7 +382,7 @@ describe 'Test html_api_V4' do
382
382
 
383
383
  expect(answer.code).to eql(200)
384
384
  expect(answer.status).to eql('completed')
385
- expect(@storage_api.object_exists(answer.file)).to be_truthy
385
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
386
386
  end
387
387
  }
388
388
  end
@@ -406,7 +406,7 @@ describe 'Test html_api_V4' do
406
406
 
407
407
  expect(answer.code).to eql(200)
408
408
  expect(answer.status).to eql('completed')
409
- expect(@storage_api.object_exists(answer.file)).to be_truthy
409
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
410
410
  end
411
411
  }
412
412
  end
@@ -579,4 +579,317 @@ describe 'Test html_api_V4' do
579
579
  }
580
580
  end
581
581
  end
582
+
583
+ describe 'convert SVG local to local' do
584
+
585
+ src = File.realpath(__dir__ + '/../../testdata') + '/testpage1.svg'
586
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
587
+
588
+ describe 'convert local to local SVG to doc' do
589
+
590
+ %w[pdf xps].each { |ext|
591
+ it "Convert SVG to " + ext do
592
+
593
+ dst = dst_dir + 'locToLocDocSVG.' + ext
594
+ answer = @html_api.convert_local_to_local(src, dst)
595
+
596
+ expect(answer.code).to eql(200)
597
+ expect(answer.status).to eql('completed')
598
+ expect(File.exist?(answer.file)).to be_truthy
599
+ end
600
+ }
601
+ end
602
+
603
+ describe 'convert local to local SVG to doc with options' do
604
+
605
+ %w[pdf xps].each { |ext|
606
+ it "Convert SVG to " + ext do
607
+
608
+ options_A4 = {
609
+ width: 8.3,
610
+ height: 11.7,
611
+ top_margin: 0.5,
612
+ bottom_margin: 0.5,
613
+ left_margin: 0.5,
614
+ right_margin: 0.5
615
+ }
616
+
617
+ dst = dst_dir + 'locToLocDocSVGWithOpts.' + ext
618
+ answer = @html_api.convert_local_to_local(src, dst, options_A4)
619
+
620
+ expect(answer.code).to eql(200)
621
+ expect(answer.status).to eql('completed')
622
+ expect(File.exist?(answer.file)).to be_truthy
623
+ end
624
+ }
625
+ end
626
+
627
+ describe 'convert local to local SVG to image' do
628
+
629
+ %w[jpeg jpg bmp png tiff tif gif].each { |ext|
630
+ it "Convert SVG to " + ext do
631
+
632
+ dst = dst_dir + 'locToLocSVGImg.' + ext
633
+ answer = @html_api.convert_local_to_local(src, dst)
634
+
635
+ expect(answer.code).to eql(200)
636
+ expect(answer.status).to eql('completed')
637
+ expect(File.exist?(answer.file)).to be_truthy
638
+ end
639
+ }
640
+ end
641
+
642
+ describe 'convert local to local SVG to image with options' do
643
+
644
+ opts = {
645
+ width: 800,
646
+ height: 1000,
647
+ left_margin: 30,
648
+ right_margin: 30,
649
+ top_margin: 50,
650
+ bottom_margin: 50
651
+ }
652
+
653
+ %w[jpeg jpg bmp png tiff tif gif].each { |ext|
654
+ it "Convert SVG to " + ext do
655
+
656
+ dst = dst_dir + 'locToLocSVGImgOpt.' + ext
657
+ answer = @html_api.convert_local_to_local(src, dst, opts)
658
+
659
+ expect(answer.code).to eql(200)
660
+ expect(answer.status).to eql('completed')
661
+ expect(File.exist?(answer.file)).to be_truthy
662
+ end
663
+ }
664
+ end
665
+ end
666
+
667
+ describe 'convert to SVG local to local' do
668
+
669
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
670
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
671
+
672
+ describe 'convert to SVG' do
673
+
674
+ %w[bmp jpg gif tiff png].each { |ext|
675
+ it "Trace " + ext + " to svg" do
676
+ dst = dst_dir + ext.upcase + 'toSVG.svg'
677
+ answer = @html_api.convert_local_to_local(src + ext, dst)
678
+
679
+ expect(answer.code).to eql(200)
680
+ expect(answer.status).to eql('completed')
681
+ expect(File.exist?(answer.file)).to be_truthy
682
+ end
683
+ }
684
+ end
685
+
686
+ describe 'convert to SVG with options' do
687
+
688
+ %w[bmp jpg gif tiff png].each { |ext|
689
+ it "Trace to SVG with opts " + ext do
690
+
691
+ opts = {
692
+ error_threshold: 30,
693
+ max_iterations: 50,
694
+ colors_limit: 3,
695
+ line_width: 2.0,
696
+ }
697
+ dst = dst_dir + ext.upcase + 'ToSVGWithOpts.svg'
698
+ answer = @html_api.convert_local_to_local(src + ext, dst, opts)
699
+
700
+ expect(answer.code).to eql(200)
701
+ expect(answer.status).to eql('completed')
702
+ expect(File.exist?(answer.file)).to be_truthy
703
+ end
704
+ }
705
+ end
706
+ end
707
+
708
+ describe 'vectorize an image to SVG local to local' do
709
+
710
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
711
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
712
+
713
+ describe 'vectorize to SVG' do
714
+
715
+ %w[bmp jpg gif tiff png].each { |ext|
716
+ it "Vectorize " + ext + " to svg" do
717
+ dst = dst_dir + ext.upcase + 'VectorizetoSVG.svg'
718
+ answer = @html_api.vectorize_local_to_local(src + ext, dst)
719
+
720
+ expect(answer.code).to eql(200)
721
+ expect(answer.status).to eql('completed')
722
+ expect(File.exist?(answer.file)).to be_truthy
723
+ end
724
+ }
725
+ end
726
+
727
+ describe 'vectorize to SVG with options' do
728
+
729
+ %w[bmp jpg gif tiff png].each { |ext|
730
+ it "Vectorize to SVG with opts " + ext do
731
+
732
+ opts = {
733
+ error_threshold: 30,
734
+ max_iterations: 50,
735
+ colors_limit: 3,
736
+ line_width: 2.0,
737
+ }
738
+ dst = dst_dir + ext.upcase + 'VectorizeToSVGWithOpts.svg'
739
+ answer = @html_api.vectorize_local_to_local(src + ext, dst, opts)
740
+
741
+ expect(answer.code).to eql(200)
742
+ expect(answer.status).to eql('completed')
743
+ expect(File.exist?(answer.file)).to be_truthy
744
+ end
745
+ }
746
+ end
747
+ end
748
+
749
+ describe 'vectorize an image to SVG local to storage' do
750
+
751
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
752
+ dst_dir = '/VectorizeSvgRuby/'
753
+
754
+ describe 'vectorize to SVG' do
755
+
756
+ %w[bmp jpg gif tiff png].each { |ext|
757
+ it "Vectorize " + ext + " to svg" do
758
+ dst = dst_dir + ext.upcase + 'VectorizetoSVG.svg'
759
+ answer = @html_api.vectorize_local_to_storage(src + ext, dst, nil)
760
+
761
+ expect(answer.code).to eql(200)
762
+ expect(answer.status).to eql('completed')
763
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
764
+ end
765
+ }
766
+ end
767
+
768
+ describe 'vectorize to SVG with options' do
769
+
770
+ %w[bmp jpg gif tiff png].each { |ext|
771
+ it "Vectorize to SVG with opts " + ext do
772
+
773
+ opts = {
774
+ error_threshold: 30,
775
+ max_iterations: 50,
776
+ colors_limit: 3,
777
+ line_width: 2.0,
778
+ }
779
+ dst = dst_dir + ext.upcase + 'VectorizeToSVGWithOpts.svg'
780
+ answer = @html_api.vectorize_local_to_storage(src + ext, dst, opts)
781
+
782
+ expect(answer.code).to eql(200)
783
+ expect(answer.status).to eql('completed')
784
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
785
+ end
786
+ }
787
+ end
788
+ end
789
+
790
+ describe 'vectorize an image to SVG storage to local' do
791
+
792
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
793
+ src_dir = '/RubyTest/'
794
+ dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
795
+
796
+ describe 'vectorize to SVG' do
797
+ %w[bmp jpg gif tiff png].each { |ext|
798
+ it "Vectorize " + ext + " to svg" do
799
+ uploaded_file = src + ext
800
+
801
+ res = @storage_api.upload_file(src_dir, uploaded_file)
802
+ expect(res.uploaded.length).to eql(1)
803
+ expect(res.errors.length).to eql(0)
804
+
805
+ dst = dst_dir + ext.upcase + 'StorToLoc.svg'
806
+ answer = @html_api.vectorize_storage_to_local(src_dir + 'car.' + ext, dst, nil)
807
+
808
+ expect(answer.code).to eql(200)
809
+ expect(answer.status).to eql('completed')
810
+ expect(File.exist?(answer.file)).to be_truthy
811
+ end
812
+ }
813
+ end
814
+
815
+ describe 'vectorize to SVG with options' do
816
+
817
+ %w[bmp jpg gif tiff png].each { |ext|
818
+ it "Vectorize to SVG with opts " + ext do
819
+
820
+ opts = {
821
+ error_threshold: 30,
822
+ max_iterations: 50,
823
+ colors_limit: 3,
824
+ line_width: 2.0,
825
+ }
826
+ uploaded_file = src + ext
827
+
828
+ res = @storage_api.upload_file(src_dir, uploaded_file)
829
+ expect(res.uploaded.length).to eql(1)
830
+ expect(res.errors.length).to eql(0)
831
+
832
+ dst = dst_dir + ext.upcase + 'StorToLocWithOpts.svg'
833
+ answer = @html_api.vectorize_storage_to_local(src_dir + 'car.' + ext, dst, nil, opts)
834
+
835
+ expect(answer.code).to eql(200)
836
+ expect(answer.status).to eql('completed')
837
+ expect(File.exist?(answer.file)).to be_truthy
838
+ end
839
+ }
840
+ end
841
+ end
842
+
843
+ describe 'vectorize an image to SVG storage to storage' do
844
+
845
+ src = File.realpath(__dir__ + '/../../testdata') + '/car.'
846
+ src_dir = '/RubyTest/'
847
+
848
+ describe 'vectorize to SVG' do
849
+ %w[bmp jpg gif tiff png].each { |ext|
850
+ it "Vectorize " + ext + " to svg" do
851
+ uploaded_file = src + ext
852
+
853
+ res = @storage_api.upload_file(src_dir, uploaded_file)
854
+ expect(res.uploaded.length).to eql(1)
855
+ expect(res.errors.length).to eql(0)
856
+
857
+ dst = src_dir + ext.upcase + 'StorToStor.svg'
858
+ answer = @html_api.vectorize_storage_to_storage(src_dir + 'car.' + ext, dst, nil)
859
+
860
+ expect(answer.code).to eql(200)
861
+ expect(answer.status).to eql('completed')
862
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
863
+ end
864
+ }
865
+ end
866
+
867
+ describe 'vectorize to SVG with options' do
868
+
869
+ %w[bmp jpg gif tiff png].each { |ext|
870
+ it "Vectorize to SVG with opts " + ext do
871
+
872
+ opts = {
873
+ error_threshold: 30,
874
+ max_iterations: 50,
875
+ colors_limit: 3,
876
+ line_width: 2.0,
877
+ }
878
+ uploaded_file = src + ext
879
+
880
+ res = @storage_api.upload_file(src_dir, uploaded_file)
881
+ expect(res.uploaded.length).to eql(1)
882
+ expect(res.errors.length).to eql(0)
883
+
884
+ dst = src_dir + ext.upcase + 'StorToStorWithOpts.svg'
885
+ answer = @html_api.vectorize_storage_to_storage(src_dir + 'car.' + ext, dst, nil, opts)
886
+
887
+ expect(answer.code).to eql(200)
888
+ expect(answer.status).to eql('completed')
889
+ expect(@storage_api.object_exists(answer.file).exists).to be_truthy
890
+ end
891
+ }
892
+ end
893
+ end
894
+
582
895
  end
data/spec/spec_helper.rb CHANGED
@@ -30,14 +30,10 @@
30
30
  require 'aspose_html_cloud'
31
31
 
32
32
  CONFIG = {
33
- # "basePath": "https://api.aspose.cloud/v4.0",
34
- # "authPath": "https://api.aspose.cloud/connect/token",
35
- # "apiKey": "c8dda7d6445d82635b8797d1c8edd153",
36
- # "appSID": "2225baa2-097b-4731-9831-d0d56c28230f",
37
- "basePath": "http://localhost:5000/v4.0",
38
- "authPath": "https://api-qa.aspose.cloud/connect/token",
39
- "apiKey": "html.cloud",
40
- "appSID": "html.cloud",
33
+ "basePath": "https://api.aspose.cloud/v4.0",
34
+ "authPath": "https://api.aspose.cloud/connect/token",
35
+ "apiKey": "c8dda7d6445d82635b8797d1c8edd153",
36
+ "appSID": "2225baa2-097b-4731-9831-d0d56c28230f",
41
37
  "debug": true
42
38
  }
43
39
  # from storage api
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_html_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 22.10.2
4
+ version: 22.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Makogon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-28 00:00:00.000000000 Z
11
+ date: 2022-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -203,7 +203,6 @@ files:
203
203
  - lib/aspose_html_cloud/api_error.rb
204
204
  - lib/aspose_html_cloud/configuration.rb
205
205
  - lib/aspose_html_cloud/models/base_model.rb
206
- - lib/aspose_html_cloud/models/conversion_result.rb
207
206
  - lib/aspose_html_cloud/models/disc_usage.rb
208
207
  - lib/aspose_html_cloud/models/error.rb
209
208
  - lib/aspose_html_cloud/models/error_details.rb
@@ -212,6 +211,7 @@ files:
212
211
  - lib/aspose_html_cloud/models/files_list.rb
213
212
  - lib/aspose_html_cloud/models/files_upload_result.rb
214
213
  - lib/aspose_html_cloud/models/object_exist.rb
214
+ - lib/aspose_html_cloud/models/operation_result.rb
215
215
  - lib/aspose_html_cloud/models/storage_exist.rb
216
216
  - lib/aspose_html_cloud/models/storage_file.rb
217
217
  - lib/aspose_html_cloud/version.rb