aspose_html_cloud 22.10.1 → 22.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aspose_html_cloud/api/html_api.rb +38 -33
- data/lib/aspose_html_cloud/api_client.rb +1 -1
- data/spec/api/html_api_spec.rb +294 -0
- data/spec/spec_helper.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d1b7ca4f575f576715bd56b470d6e326e18439c9f626e941f8242b9632e73e9
|
4
|
+
data.tar.gz: e32204d5d61c8e07a66cfa3c6ed1bf7483948ea79af04210dc2b80023b696594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f89551d802e98480870d680e176524482be01506aee6971d86236412e3cba069998b208d6ae31aff814e265f68ee293ba18c29c838e15302d7862f0fdc58709
|
7
|
+
data.tar.gz: 3af762e1b9007b820d08ddadef2291cd506b8e30687fd086770954fa4cfd25f79a1feca89d7a4ebcff52c97dd0e7f7fb9da9c675582fb59ff6cdcd9801482ffd
|
@@ -43,7 +43,7 @@ module AsposeHtml
|
|
43
43
|
#
|
44
44
|
# @param src Full path to source file.
|
45
45
|
# @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
|
46
|
-
# @param [Hash] options the optional parameters
|
46
|
+
# @param [Hash, nil] options the optional parameters
|
47
47
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
48
48
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
49
49
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -52,7 +52,7 @@ module AsposeHtml
|
|
52
52
|
# @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
53
53
|
# @return [ConversionResult] Result of conversion. See ConversionResult 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
58
|
# Converting the HTML, EPUB document from the local file and putting the result in the storage
|
@@ -60,7 +60,7 @@ module AsposeHtml
|
|
60
60
|
# @param src Full path to source file.
|
61
61
|
# @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
|
62
62
|
# @param storage Storage name. Default storage is nil.
|
63
|
-
# @param [Hash] options the optional parameters
|
63
|
+
# @param [Hash, nil] options the optional parameters
|
64
64
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
65
65
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
66
66
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -69,7 +69,7 @@ module AsposeHtml
|
|
69
69
|
# @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
70
70
|
# @return [ConversionResult] Result of conversion. See ConversionResult 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
75
|
# Converting the HTML, EPUB document from the storage and putting the result in the local file
|
@@ -77,7 +77,7 @@ module AsposeHtml
|
|
77
77
|
# @param src Full path to source file.
|
78
78
|
# @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
|
79
79
|
# @param storage Storage name. Default storage is nil.
|
80
|
-
# @param [Hash] options the optional parameters
|
80
|
+
# @param [Hash, nil] options the optional parameters
|
81
81
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
82
82
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
83
83
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -86,7 +86,7 @@ module AsposeHtml
|
|
86
86
|
# @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
87
87
|
# @return [ConversionResult] Result of conversion. See ConversionResult 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
92
|
# Converting the HTML, EPUB document from the storage and putting the result in the storage
|
@@ -94,7 +94,7 @@ module AsposeHtml
|
|
94
94
|
# @param src Full path to source file.
|
95
95
|
# @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
|
96
96
|
# @param storage Storage name. Default storage is nil.
|
97
|
-
# @param [Hash] options the optional parameters
|
97
|
+
# @param [Hash, nil] options the optional parameters
|
98
98
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
99
99
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
100
100
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -103,14 +103,14 @@ module AsposeHtml
|
|
103
103
|
# @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
104
104
|
# @return [ConversionResult] Result of conversion. See ConversionResult 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
|
108
108
|
|
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
112
|
# @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
|
113
|
-
# @param [Hash] options the optional parameters
|
113
|
+
# @param [Hash, nil] options the optional parameters
|
114
114
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
115
115
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
116
116
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -119,7 +119,7 @@ module AsposeHtml
|
|
119
119
|
# @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
120
120
|
# @return [ConversionResult] Result of conversion. See ConversionResult object.
|
121
121
|
def convert_url_to_local(src, dst, options=nil)
|
122
|
-
|
122
|
+
convert(src, dst, false, true, true, options)
|
123
123
|
end
|
124
124
|
|
125
125
|
# Converting the HTML page from URL and putting the result in the storage
|
@@ -127,7 +127,7 @@ module AsposeHtml
|
|
127
127
|
# @param src URI of the website.
|
128
128
|
# @param dst Full path to a result file (pdf, xps, docx, md, mhtml, jpeg, png, bmp, tiff, gif).
|
129
129
|
# @param storage Storage name. Default storage is nil.
|
130
|
-
# @param [Hash] options the optional parameters
|
130
|
+
# @param [Hash, nil] options the optional parameters
|
131
131
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
132
132
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
133
133
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -136,7 +136,7 @@ module AsposeHtml
|
|
136
136
|
# @option options [Double] :bottom_margin Bottom resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
137
137
|
# @return [ConversionResult] Result of conversion. See ConversionResult 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
142
|
# Converting the HTML document to various formats
|
@@ -146,7 +146,7 @@ module AsposeHtml
|
|
146
146
|
# @param src_in_local Flag, true if source in the local file.
|
147
147
|
# @param dst_in_local Flag, true if result in the local file.
|
148
148
|
# @param is_url Flag, true if source is website.
|
149
|
-
# @param [Hash] options the optional parameters
|
149
|
+
# @param [Hash, nil] options the optional parameters
|
150
150
|
# @option options [Double] :width Resulting width. For images in pixels, for PDF, XPS, DOCX in inches.
|
151
151
|
# @option options [Double] :height Resulting height. For images in pixels, for PDF, XPS, DOCX in inches.
|
152
152
|
# @option options [Double] :left_margin Left resulting margin. For images in pixels, for PDF, XPS, DOCX in inches.
|
@@ -189,15 +189,22 @@ module AsposeHtml
|
|
189
189
|
post_body[:'outputFile'] = out_file.to_s
|
190
190
|
post_body[:'storageName'] = storage_name.to_s
|
191
191
|
|
192
|
-
|
192
|
+
unless options.nil?
|
193
193
|
post_body[:'options'] = {}
|
194
|
-
post_body[:'options'][:'width'] = options[:'width']
|
195
|
-
post_body[:'options'][:'height'] = options[:'height']
|
196
|
-
post_body[:'options'][:'leftMargin'] = options[:'left_margin']
|
197
|
-
post_body[:'options'][:'rightMargin'] = options[:'right_margin']
|
198
|
-
post_body[:'options'][:'topMargin'] = options[:'top_margin']
|
199
|
-
post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin']
|
200
|
-
post_body[:'options'][:'resolution'] = options[:'resolution']
|
194
|
+
post_body[:'options'][:'width'] = options[:'width'] unless options[:'width'].nil?
|
195
|
+
post_body[:'options'][:'height'] = options[:'height'] unless options[:'height'].nil?
|
196
|
+
post_body[:'options'][:'leftMargin'] = options[:'left_margin'] unless options[:'left_margin'].nil?
|
197
|
+
post_body[:'options'][:'rightMargin'] = options[:'right_margin'] unless options[:'right_margin'].nil?
|
198
|
+
post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?
|
199
|
+
post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?
|
200
|
+
post_body[:'options'][:'resolution'] = options[:'resolution'] unless options[:'resolution'].nil?
|
201
|
+
post_body[:'options'][:'background'] = options[:'background'] unless options[:'background'].nil?
|
202
|
+
post_body[:'options'][:'jpegquality'] = options[:'jpeg_quality'] unless options[:'jpeg_quality'].nil?
|
203
|
+
post_body[:'options'][:'usegit'] = options[:'use_git'] unless options[:'use_git'].nil?
|
204
|
+
post_body[:'options'][:'error_threshold'] = options[:'error_threshold'] unless options[:'error_threshold'].nil?
|
205
|
+
post_body[:'options'][:'max_iterations'] = options[:'max_iterations'] unless options[:'max_iterations'].nil?
|
206
|
+
post_body[:'options'][:'colors_limit'] = options[:'colors_limit'] unless options[:'colors_limit'].nil?
|
207
|
+
post_body[:'options'][:'line_width'] = options[:'line_width'] unless options[:'line_width'].nil?
|
201
208
|
end
|
202
209
|
|
203
210
|
query_params = {}
|
@@ -268,22 +275,20 @@ module AsposeHtml
|
|
268
275
|
end
|
269
276
|
|
270
277
|
def get_input_format(path)
|
271
|
-
ext = File.extname(path).
|
278
|
+
ext = File.extname(path).downcase[1..-1]
|
272
279
|
case ext
|
273
|
-
when '
|
280
|
+
when 'htm'
|
274
281
|
return 'html'
|
275
|
-
when '
|
276
|
-
return '
|
277
|
-
when '
|
282
|
+
when 'mht'
|
283
|
+
return 'mhtml'
|
284
|
+
when 'xml'
|
278
285
|
return 'xhtml'
|
279
|
-
when '
|
280
|
-
return '
|
281
|
-
when '
|
282
|
-
return '
|
283
|
-
when '.MD'
|
284
|
-
return 'md'
|
286
|
+
when 'jpg'
|
287
|
+
return 'jpeg'
|
288
|
+
when 'tif'
|
289
|
+
return 'tiff'
|
285
290
|
else
|
286
|
-
|
291
|
+
ext
|
287
292
|
end
|
288
293
|
end
|
289
294
|
|
data/spec/api/html_api_spec.rb
CHANGED
@@ -411,4 +411,298 @@ describe 'Test html_api_V4' do
|
|
411
411
|
}
|
412
412
|
end
|
413
413
|
end
|
414
|
+
|
415
|
+
describe 'convert markdown local to local' do
|
416
|
+
|
417
|
+
src = File.realpath(__dir__ + '/../../testdata') + '/README.md'
|
418
|
+
dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
|
419
|
+
|
420
|
+
describe 'convert local to local markdown to doc' do
|
421
|
+
|
422
|
+
%w[pdf xps docx html mhtml mht].each { |ext|
|
423
|
+
it "Convert markdown to " + ext do
|
424
|
+
|
425
|
+
dst = dst_dir + 'locToLocDocMD.' + ext
|
426
|
+
answer = @html_api.convert_local_to_local(src, dst)
|
427
|
+
|
428
|
+
expect(answer.code).to eql(200)
|
429
|
+
expect(answer.status).to eql('completed')
|
430
|
+
expect(File.exist?(answer.file)).to be_truthy
|
431
|
+
end
|
432
|
+
}
|
433
|
+
end
|
434
|
+
|
435
|
+
describe 'convert local to local markdown to doc with options' do
|
436
|
+
|
437
|
+
%w[pdf xps docx].each { |ext|
|
438
|
+
it "Convert markdown to " + ext do
|
439
|
+
|
440
|
+
options_A4 = {
|
441
|
+
width: 8.3,
|
442
|
+
height: 11.7,
|
443
|
+
top_margin: 0.5,
|
444
|
+
bottom_margin: 0.5,
|
445
|
+
left_margin: 0.5,
|
446
|
+
right_margin: 0.5
|
447
|
+
}
|
448
|
+
|
449
|
+
dst = dst_dir + 'locToLocDocMDWithOpts.' + ext
|
450
|
+
answer = @html_api.convert_local_to_local(src, dst, options_A4)
|
451
|
+
|
452
|
+
expect(answer.code).to eql(200)
|
453
|
+
expect(answer.status).to eql('completed')
|
454
|
+
expect(File.exist?(answer.file)).to be_truthy
|
455
|
+
end
|
456
|
+
}
|
457
|
+
end
|
458
|
+
|
459
|
+
describe 'convert local to local markdown to image' do
|
460
|
+
|
461
|
+
%w[jpeg jpg bmp png tiff tif gif].each { |ext|
|
462
|
+
it "Convert markdown to " + ext do
|
463
|
+
|
464
|
+
dst = dst_dir + 'locToLocMDImg.' + ext
|
465
|
+
answer = @html_api.convert_local_to_local(src, dst)
|
466
|
+
|
467
|
+
expect(answer.code).to eql(200)
|
468
|
+
expect(answer.status).to eql('completed')
|
469
|
+
expect(File.exist?(answer.file)).to be_truthy
|
470
|
+
end
|
471
|
+
}
|
472
|
+
end
|
473
|
+
|
474
|
+
describe 'convert local to local markdown to image with options' do
|
475
|
+
|
476
|
+
opts = {
|
477
|
+
width: 800,
|
478
|
+
height: 1000,
|
479
|
+
left_margin: 30,
|
480
|
+
right_margin: 30,
|
481
|
+
top_margin: 50,
|
482
|
+
bottom_margin: 50
|
483
|
+
}
|
484
|
+
|
485
|
+
%w[jpeg jpg bmp png tiff tif gif].each { |ext|
|
486
|
+
it "Convert markdown to " + ext do
|
487
|
+
|
488
|
+
dst = dst_dir + 'locToLocMDImgOpt.' + ext
|
489
|
+
answer = @html_api.convert_local_to_local(src, dst, opts)
|
490
|
+
|
491
|
+
expect(answer.code).to eql(200)
|
492
|
+
expect(answer.status).to eql('completed')
|
493
|
+
expect(File.exist?(answer.file)).to be_truthy
|
494
|
+
end
|
495
|
+
}
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
describe 'convert MHTML local to local' do
|
500
|
+
|
501
|
+
src = File.realpath(__dir__ + '/../../testdata') + '/fileformatinfo.mht'
|
502
|
+
dst_dir = File.realpath(__dir__ + '/../../testresult') + '/'
|
503
|
+
|
504
|
+
describe 'convert local to local MHTML to doc' do
|
505
|
+
|
506
|
+
%w[pdf xps docx].each { |ext|
|
507
|
+
it "Convert MHTML to " + ext do
|
508
|
+
|
509
|
+
dst = dst_dir + 'locToLocDocMHTML.' + ext
|
510
|
+
answer = @html_api.convert_local_to_local(src, dst)
|
511
|
+
|
512
|
+
expect(answer.code).to eql(200)
|
513
|
+
expect(answer.status).to eql('completed')
|
514
|
+
expect(File.exist?(answer.file)).to be_truthy
|
515
|
+
end
|
516
|
+
}
|
517
|
+
end
|
518
|
+
|
519
|
+
describe 'convert local to local MHTML to doc with options' do
|
520
|
+
|
521
|
+
%w[pdf xps docx].each { |ext|
|
522
|
+
it "Convert MHTML to " + ext do
|
523
|
+
|
524
|
+
options_A4 = {
|
525
|
+
width: 8.3,
|
526
|
+
height: 11.7,
|
527
|
+
top_margin: 0.5,
|
528
|
+
bottom_margin: 0.5,
|
529
|
+
left_margin: 0.5,
|
530
|
+
right_margin: 0.5
|
531
|
+
}
|
532
|
+
|
533
|
+
dst = dst_dir + 'locToLocDocMHTMLWithOpts.' + ext
|
534
|
+
answer = @html_api.convert_local_to_local(src, dst, options_A4)
|
535
|
+
|
536
|
+
expect(answer.code).to eql(200)
|
537
|
+
expect(answer.status).to eql('completed')
|
538
|
+
expect(File.exist?(answer.file)).to be_truthy
|
539
|
+
end
|
540
|
+
}
|
541
|
+
end
|
542
|
+
|
543
|
+
describe 'convert local to local MHTML to image' do
|
544
|
+
|
545
|
+
%w[jpeg jpg bmp png tiff tif gif].each { |ext|
|
546
|
+
it "Convert MHTML to " + ext do
|
547
|
+
|
548
|
+
dst = dst_dir + 'locToLocMHTMLImg.' + ext
|
549
|
+
answer = @html_api.convert_local_to_local(src, dst)
|
550
|
+
|
551
|
+
expect(answer.code).to eql(200)
|
552
|
+
expect(answer.status).to eql('completed')
|
553
|
+
expect(File.exist?(answer.file)).to be_truthy
|
554
|
+
end
|
555
|
+
}
|
556
|
+
end
|
557
|
+
|
558
|
+
describe 'convert local to local MHTML to image with options' do
|
559
|
+
|
560
|
+
opts = {
|
561
|
+
width: 800,
|
562
|
+
height: 1000,
|
563
|
+
left_margin: 30,
|
564
|
+
right_margin: 30,
|
565
|
+
top_margin: 50,
|
566
|
+
bottom_margin: 50
|
567
|
+
}
|
568
|
+
|
569
|
+
%w[jpeg jpg bmp png tiff tif gif].each { |ext|
|
570
|
+
it "Convert MHTML to " + ext do
|
571
|
+
|
572
|
+
dst = dst_dir + 'locToLocMHTMLImgOpt.' + ext
|
573
|
+
answer = @html_api.convert_local_to_local(src, dst, opts)
|
574
|
+
|
575
|
+
expect(answer.code).to eql(200)
|
576
|
+
expect(answer.status).to eql('completed')
|
577
|
+
expect(File.exist?(answer.file)).to be_truthy
|
578
|
+
end
|
579
|
+
}
|
580
|
+
end
|
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
|
+
|
707
|
+
end
|
414
708
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -30,10 +30,14 @@
|
|
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",
|
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",
|
37
41
|
"debug": true
|
38
42
|
}
|
39
43
|
# 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.
|
4
|
+
version: 22.11.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-
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|