aspose_html_cloud 22.10.2 → 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 +16 -11
- data/lib/aspose_html_cloud/api_client.rb +1 -1
- data/spec/api/html_api_spec.rb +126 -0
- 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
|
@@ -198,6 +198,13 @@ module AsposeHtml
|
|
198
198
|
post_body[:'options'][:'topMargin'] = options[:'top_margin'] unless options[:'top_margin'].nil?
|
199
199
|
post_body[:'options'][:'bottomMargin'] = options[:'bottom_margin'] unless options[:'bottom_margin'].nil?
|
200
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 '
|
282
|
+
when 'mht'
|
276
283
|
return 'mhtml'
|
277
|
-
when '
|
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
@@ -579,4 +579,130 @@ 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
|
+
|
707
|
+
end
|
582
708
|
end
|
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
|