asposecloud 1.0.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +31 -9
- data/Tests/Barcode/builder_tests.rb +95 -0
- data/Tests/Barcode/reader_tests.rb +70 -0
- data/Tests/Cells/charteditor_tests.rb +139 -0
- data/Tests/Cells/converter_tests.rb +83 -0
- data/Tests/Cells/extractor_tests.rb +40 -0
- data/Tests/Cells/texteditor_tests.rb +52 -0
- data/Tests/Cells/workbook_tests.rb +167 -0
- data/Tests/Cells/worksheet_tests.rb +435 -0
- data/Tests/Data/barcodeQR.bmp +0 -0
- data/Tests/Data/barcodeQR.jpg +0 -0
- data/Tests/Data/barcodeQR.tiff +0 -0
- data/Tests/Data/bizcard.psd +0 -0
- data/Tests/Data/macbook.gif +0 -0
- data/Tests/Data/mail_merge_regions.docx +0 -0
- data/Tests/Data/mail_merge_template.docx +0 -0
- data/Tests/Data/test_cells.xlsx +0 -0
- data/Tests/Data/test_multi_pages.docx +0 -0
- data/Tests/Data/test_slides.pptx +0 -0
- data/Tests/Email/converter_tests.rb +30 -0
- data/Tests/Email/document_tests.rb +55 -0
- data/Tests/Imaging/converter_tests.rb +32 -0
- data/Tests/Imaging/document_tests.rb +132 -0
- data/Tests/Imaging/extractor_tests.rb +67 -0
- data/Tests/Imaging/image_tests.rb +55 -0
- data/Tests/Ocr/extractor_tests.rb +34 -0
- data/Tests/Pdf/annotationeditor_tests.rb +128 -0
- data/Tests/Pdf/converter_tests.rb +74 -0
- data/Tests/Pdf/document_tests.rb +285 -0
- data/Tests/Pdf/extractor_tests.rb +37 -0
- data/Tests/Pdf/texteditor_tests.rb +84 -0
- data/Tests/Slides/converter_tests.rb +59 -0
- data/Tests/Slides/document_tests.rb +187 -0
- data/Tests/Slides/extractor_tests.rb +92 -0
- data/Tests/Storage/folder_tests.rb +64 -0
- data/Tests/Tasks/assignments_tests.rb +44 -0
- data/Tests/Tasks/calendar_tests.rb +45 -0
- data/Tests/Tasks/converter_tests.rb +32 -0
- data/Tests/Tasks/document_tests.rb +114 -0
- data/Tests/Tasks/resources_tests.rb +44 -0
- data/Tests/Words/builder_tests.rb +56 -0
- data/Tests/Words/converter_tests.rb +54 -0
- data/Tests/Words/document_tests.rb +208 -0
- data/Tests/Words/extractor_tests.rb +120 -0
- data/Tests/Words/mail_merge_tests.rb +120 -0
- data/Tests/setup.json +6 -0
- data/lib/Barcode/builder.rb +270 -20
- data/lib/Barcode/reader.rb +112 -18
- data/lib/Cells/chart_editor.rb +102 -0
- data/lib/Cells/convertor.rb +22 -2
- data/lib/Cells/text_editor.rb +8 -2
- data/lib/Cells/workbook.rb +63 -3
- data/lib/Cells/worksheet.rb +479 -10
- data/lib/Common/utils.rb +2 -0
- data/lib/Email/converter.rb +2 -18
- data/lib/Email/document.rb +32 -17
- data/lib/Ocr/extractor.rb +26 -20
- data/lib/Pdf/annotation_editor.rb +0 -17
- data/lib/Pdf/converter.rb +25 -17
- data/lib/Pdf/document.rb +167 -23
- data/lib/Pdf/extractor.rb +0 -17
- data/lib/Pdf/text_editor.rb +35 -20
- data/lib/Slides/converter.rb +48 -18
- data/lib/Slides/document.rb +186 -51
- data/lib/Slides/extractor.rb +35 -18
- data/lib/Storage/folder.rb +30 -25
- data/lib/Words/builder.rb +23 -29
- data/lib/Words/converter.rb +30 -17
- data/lib/Words/document.rb +336 -28
- data/lib/Words/extractor.rb +112 -33
- data/lib/Words/mail_merge.rb +2 -20
- data/{Tests/word_tests.rb → lib/aspose_imaging.rb} +5 -17
- data/lib/asposecloud.rb +3 -1
- data/lib/asposecloud/version.rb +1 -1
- data/lib/imaging/converter.rb +55 -0
- data/lib/imaging/document.rb +301 -0
- data/lib/imaging/extractor.rb +165 -0
- data/lib/imaging/image.rb +118 -0
- data/lib/restclient.rb +36 -0
- data/lib/tasks/assignments.rb +19 -19
- data/lib/tasks/calendar.rb +27 -19
- data/lib/tasks/converter.rb +4 -17
- data/lib/tasks/document.rb +79 -22
- data/lib/tasks/resources.rb +18 -18
- metadata +70 -19
- checksums.yaml +0 -7
- data/Tests/barcode_tests.rb +0 -45
- data/Tests/cell_tests.rb +0 -41
- data/Tests/email_tests.rb +0 -43
- data/Tests/pdf_tests.rb +0 -76
- data/Tests/slide_tests.rb +0 -41
- data/Tests/storage_tests.rb +0 -86
- data/Tests/tasks_tests.rb +0 -24
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class ConverterTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_convert
|
17
|
+
# Create Object of folder class
|
18
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
19
|
+
response = folder.upload_file '../Data/email_test.eml'
|
20
|
+
assert_equal true, response
|
21
|
+
|
22
|
+
# Create object of email converter class
|
23
|
+
converter = Aspose::Cloud::Email::Converter.new('email_test.eml')
|
24
|
+
assert_nothing_thrown 'Error' do
|
25
|
+
converter.convert(save_format='msg')
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_equal true, File.exist?('../Output/email_test.msg')
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class DocumentTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_get_property
|
17
|
+
# Create Object of folder class
|
18
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
19
|
+
response = folder.upload_file '../Data/email_test.eml'
|
20
|
+
assert_equal true, response
|
21
|
+
|
22
|
+
# Create object of email document class
|
23
|
+
document = Aspose::Cloud::Email::Document.new('email_test.eml')
|
24
|
+
response = document.get_property(property_name='Subject')
|
25
|
+
assert_equal 'test', response
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_set_property
|
29
|
+
document = Aspose::Cloud::Email::Document.new('email_test.eml')
|
30
|
+
response = document.set_property(property_name='Subject', property_value='Testing')
|
31
|
+
assert_equal 'Testing', response
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_get_attachment
|
35
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
36
|
+
response = folder.upload_file '../Data/email_test_attach.eml'
|
37
|
+
assert_equal true, response
|
38
|
+
|
39
|
+
document = Aspose::Cloud::Email::Document.new('email_test_attach.eml')
|
40
|
+
assert_nothing_thrown 'Error' do
|
41
|
+
document.get_attachment(attachment_name='readme.txt')
|
42
|
+
end
|
43
|
+
|
44
|
+
assert_equal true, File.exist?('../Output/readme.txt')
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_add_attachment
|
48
|
+
document = Aspose::Cloud::Email::Document.new('email_test.eml')
|
49
|
+
assert_nothing_thrown 'Error' do
|
50
|
+
document.add_attachment(attachment_name='watermark.png')
|
51
|
+
end
|
52
|
+
|
53
|
+
assert_equal true, File.exist?('../Output/email_test.eml')
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class ConverterTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Convert Image Format
|
17
|
+
def test_convert_local_file
|
18
|
+
converter = Aspose::Cloud::Imaging::Converter.new('barcodeQR.png')
|
19
|
+
assert_nothing_thrown 'Error' do
|
20
|
+
converter.convert_local_file(input_file_path='../Data/barcodeQR.png', output_filename='barcodeQR.bmp', save_format='bmp')
|
21
|
+
end
|
22
|
+
assert_equal true, File.exist?('../Output/barcodeQR.bmp')
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_convert_tiff_to_fax
|
26
|
+
converter = Aspose::Cloud::Imaging::Converter.new('barcodeQR.png')
|
27
|
+
assert_nothing_thrown 'Error' do
|
28
|
+
converter.convert_tiff_to_fax()
|
29
|
+
end
|
30
|
+
assert_equal true, File.exist?('../Output/barcodeQR.png')
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class DocumentTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get Image Properties
|
17
|
+
def test_get_properties
|
18
|
+
document = Aspose::Cloud::Imaging::Document.new('barcodeQR.png')
|
19
|
+
response = document.get_properties()
|
20
|
+
assert_kind_of(Hash, response)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Update BMP Image Properties
|
24
|
+
def test_update_bmp_properties
|
25
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
26
|
+
response = folder.upload_file '../Data/barcodeQR.bmp'
|
27
|
+
assert_equal true, response
|
28
|
+
|
29
|
+
document = Aspose::Cloud::Imaging::Document.new('barcodeQR.bmp')
|
30
|
+
assert_nothing_thrown 'Error' do
|
31
|
+
document.update_bmp_properties(bits_per_px=24, h_resolution=100, v_resolution=100, output_path='barcodeQR_updated.bmp')
|
32
|
+
end
|
33
|
+
assert_equal true, File.exist?('../Output/barcodeQR_updated.bmp')
|
34
|
+
end
|
35
|
+
|
36
|
+
# Update BMP Image Properties Without Storage
|
37
|
+
def test_update_bmp_properties_local
|
38
|
+
document = Aspose::Cloud::Imaging::Document.new('barcodeQR.bmp')
|
39
|
+
assert_nothing_thrown 'Error' do
|
40
|
+
document.update_bmp_properties_local(input_file_path='../Data/barcodeQR.bmp', bits_per_px=24, h_resolution=100, v_resolution=100)
|
41
|
+
end
|
42
|
+
assert_equal true, File.exist?('../Output/barcodeQR_updated.bmp')
|
43
|
+
end
|
44
|
+
|
45
|
+
# Update GIF Image Properties
|
46
|
+
def test_update_gif_properties
|
47
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
48
|
+
response = folder.upload_file '../Data/macbook.gif'
|
49
|
+
assert_equal true, response
|
50
|
+
|
51
|
+
document = Aspose::Cloud::Imaging::Document.new('macbook.gif')
|
52
|
+
assert_nothing_thrown 'Error' do
|
53
|
+
document.update_gif_properties(bg_color_index=32, px_aspect_ratio=3, interlaced=true, 'macbook.gif')
|
54
|
+
end
|
55
|
+
assert_equal true, File.exist?('../Output/macbook_updated.gif')
|
56
|
+
end
|
57
|
+
|
58
|
+
# Update GIF Image Properties Without Storage
|
59
|
+
def test_update_gif_properties_local
|
60
|
+
document = Aspose::Cloud::Imaging::Document.new('macbook.gif')
|
61
|
+
assert_nothing_thrown 'Error' do
|
62
|
+
document.update_gif_properties_local(input_file_path='../Data/macbook.gif', bg_color_index=32, px_aspect_ratio=3, interlaced=true)
|
63
|
+
end
|
64
|
+
assert_equal true, File.exist?('../Output/macbook_updated.gif')
|
65
|
+
end
|
66
|
+
|
67
|
+
# Update JPG Image Properties
|
68
|
+
def test_update_jpg_properties
|
69
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
70
|
+
response = folder.upload_file '../Data/barcodeQR.jpg'
|
71
|
+
assert_equal true, response
|
72
|
+
|
73
|
+
document = Aspose::Cloud::Imaging::Document.new('barcodeQR.jpg')
|
74
|
+
assert_nothing_thrown 'Error' do
|
75
|
+
document.update_jpg_properties(quality=45, compression_type='baseline', output_path='barcodeQR.jpg')
|
76
|
+
end
|
77
|
+
assert_equal true, File.exist?('../Output/barcodeQR_updated.jpg')
|
78
|
+
end
|
79
|
+
|
80
|
+
# Update JPG Image Properties Without Storage
|
81
|
+
def test_update_jpg_properties_local
|
82
|
+
document = Aspose::Cloud::Imaging::Document.new('barcodeQR.jpg')
|
83
|
+
assert_nothing_thrown 'Error' do
|
84
|
+
document.update_jpg_properties_local(input_file_path='../Data/barcodeQR.jpg', quality=45, compression_type='baseline')
|
85
|
+
end
|
86
|
+
assert_equal true, File.exist?('../Output/barcodeQR_updated.jpg')
|
87
|
+
end
|
88
|
+
|
89
|
+
# Update PSD Image Properties
|
90
|
+
def test_update_psd_properties (later)
|
91
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
92
|
+
response = folder.upload_file '../Data/bizcard.psd'
|
93
|
+
assert_equal true, response
|
94
|
+
|
95
|
+
document = Aspose::Cloud::Imaging::Document.new('bizcard.psd')
|
96
|
+
assert_nothing_thrown 'Error' do
|
97
|
+
document.update_psd_properties(channels_count=3, compression_method='rle', output_path='bizcard.psd')
|
98
|
+
end
|
99
|
+
assert_equal true, File.exist?('../Output/bizcard_updated.psd')
|
100
|
+
end
|
101
|
+
|
102
|
+
# Update PSD Image Properties Without Storage
|
103
|
+
def test_update_psd_properties_local (later)
|
104
|
+
document = Aspose::Cloud::Imaging::Document.new('bizcard.psd')
|
105
|
+
assert_nothing_thrown 'Error' do
|
106
|
+
document.update_psd_properties_local(input_file_path='../Data/bizcard.psd', channels_count=4, compression_method='raw')
|
107
|
+
end
|
108
|
+
assert_equal true, File.exist?('../Output/bizcard_updated.psd')
|
109
|
+
end
|
110
|
+
|
111
|
+
# Update TIFF Image Properties
|
112
|
+
def test_update_tiff_properties
|
113
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
114
|
+
response = folder.upload_file '../Data/Test.tiff'
|
115
|
+
assert_equal true, response
|
116
|
+
|
117
|
+
document = Aspose::Cloud::Imaging::Document.new('Test.tiff')
|
118
|
+
assert_nothing_thrown 'Error' do
|
119
|
+
document.update_tiff_properties(compression='CcittFax3', resolution_unit='inch', new_width=200, new_height=200, horizontal_resolution=96, vertical_resolution=96, output_path='/')
|
120
|
+
end
|
121
|
+
assert_equal true, File.exist?('../Output/Test_updated.tiff')
|
122
|
+
end
|
123
|
+
|
124
|
+
# Update TIFF Image Properties Without Storage
|
125
|
+
def test_update_tiff_properties_local
|
126
|
+
document = Aspose::Cloud::Imaging::Document.new('Test.tiff')
|
127
|
+
assert_nothing_thrown 'Error' do
|
128
|
+
document.update_tiff_properties_local(input_file_path='../Data/Test.tiff', compression='ccittfax3', resolution_unit='inch', new_width=200, new_height=200, horizontal_resolution=96, vertical_resolution=96, output_path='/')
|
129
|
+
end
|
130
|
+
assert_equal true, File.exist?('../Output/Test_updated.tiff')
|
131
|
+
end
|
132
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class ExtractorTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Get TIFF Frame Properties
|
17
|
+
def test_get_tiff_frame_properties
|
18
|
+
extractor = Aspose::Cloud::Imaging::Extractor.new('Test.tiff')
|
19
|
+
response = extractor.get_tiff_frame_properties(frame_id=1)
|
20
|
+
assert_instance_of(Hash, response)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Extract Frame from a Multi-Frame TIFF Image
|
24
|
+
def test_extract_frame
|
25
|
+
extractor = Aspose::Cloud::Imaging::Extractor.new('Test.tiff')
|
26
|
+
assert_nothing_thrown 'Error' do
|
27
|
+
extractor.extract_frame(frame_id=1, output_filename='extract_frame.tiff')
|
28
|
+
end
|
29
|
+
assert_equal true, File.exist?('../Output/extract_frame_updated.tiff')
|
30
|
+
end
|
31
|
+
|
32
|
+
# Resize a TIFF Frame
|
33
|
+
def test_resize_frame
|
34
|
+
extractor = Aspose::Cloud::Imaging::Extractor.new('Test.tiff')
|
35
|
+
assert_nothing_thrown 'Error' do
|
36
|
+
extractor.resize_frame(frame_id=1, new_width=100, new_height=100, output_filename='resize_frame.tiff')
|
37
|
+
end
|
38
|
+
assert_equal true, File.exist?('../Output/resize_frame_updated.tiff')
|
39
|
+
end
|
40
|
+
|
41
|
+
# Crop a TIFF Frame
|
42
|
+
def test_crop_frame
|
43
|
+
extractor = Aspose::Cloud::Imaging::Extractor.new('Test.tiff')
|
44
|
+
assert_nothing_thrown 'Error' do
|
45
|
+
extractor.crop_frame(frame_id=1, x_position=20, y_position=20, rect_width=200, rect_height=200, output_filename='crop_frame.tiff')
|
46
|
+
end
|
47
|
+
assert_equal true, File.exist?('../Output/crop_frame_updated.tiff')
|
48
|
+
end
|
49
|
+
|
50
|
+
# Rotate a TIFF Frame
|
51
|
+
def test_rotate_frame
|
52
|
+
extractor = Aspose::Cloud::Imaging::Extractor.new('Test.tiff')
|
53
|
+
assert_nothing_thrown 'Error' do
|
54
|
+
extractor.rotate_frame(frame_id=1, rotate_flip_method='Rotate180FlipX', output_filename='rotate_frame.tiff')
|
55
|
+
end
|
56
|
+
assert_equal true, File.exist?('../Output/rotate_frame_updated.tiff')
|
57
|
+
end
|
58
|
+
|
59
|
+
# Manipulate a Frame and Save the Modified Frame Along with Unmodified Frames
|
60
|
+
def test_manipulate_frame
|
61
|
+
extractor = Aspose::Cloud::Imaging::Extractor.new('Test.tiff')
|
62
|
+
assert_nothing_thrown 'Error' do
|
63
|
+
extractor.manipulate_frame(frame_id=1, rotate_flip_method='Rotate180FlipX', new_width=300, new_height=300, x_position=20, y_position=20, rect_width=200, rect_height=200, output_filename='manipulate_frame.tiff')
|
64
|
+
end
|
65
|
+
assert_equal true, File.exist?('../Output/manipulate_frame_updated.tiff')
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class ImageTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
# Resize Image without Storage
|
17
|
+
def test_resize_image
|
18
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
19
|
+
response = folder.upload_file '../Data/barcodeQR.png'
|
20
|
+
assert_equal true, response
|
21
|
+
|
22
|
+
image = Aspose::Cloud::Imaging::Image.new('barcodeQR.png')
|
23
|
+
assert_nothing_thrown 'Error' do
|
24
|
+
image.resize_image(input_file_path='../Data/barcodeQR.png', new_width=10, new_height=10, output_filename='barcodeQR_resized.gif', save_format='gif')
|
25
|
+
end
|
26
|
+
assert_equal true, File.exist?('../Output/barcodeQR_resized.gif')
|
27
|
+
end
|
28
|
+
|
29
|
+
# Crop Image with Format Change
|
30
|
+
def test_crop_image
|
31
|
+
image = Aspose::Cloud::Imaging::Image.new('barcodeQR.png')
|
32
|
+
assert_nothing_thrown 'Error' do
|
33
|
+
image.crop_image(x=0, y=0, width=50, height=60, output_path='/', save_format='png')
|
34
|
+
end
|
35
|
+
assert_equal true, File.exist?('../Output/barcodeQR.png')
|
36
|
+
end
|
37
|
+
|
38
|
+
# RotateFlip Image on Storage
|
39
|
+
def test_rotate_image
|
40
|
+
image = Aspose::Cloud::Imaging::Image.new('barcodeQR.png')
|
41
|
+
assert_nothing_thrown 'Error' do
|
42
|
+
image.rotate_image(method='rotate270flipnone', output_path='/', save_format='png')
|
43
|
+
end
|
44
|
+
assert_equal true, File.exist?('../Output/barcodeQR.png')
|
45
|
+
end
|
46
|
+
|
47
|
+
# Merge Tiff images
|
48
|
+
def test_append_tiff
|
49
|
+
image = Aspose::Cloud::Imaging::Image.new('Test.tiff')
|
50
|
+
assert_nothing_thrown 'Error' do
|
51
|
+
image.append_tiff(append_file='input.tiff')
|
52
|
+
end
|
53
|
+
assert_equal true, File.exist?('../Output/Test.tiff')
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class ExtractorTests < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
file = File.read('../setup.json')
|
8
|
+
data = JSON.parse(file)
|
9
|
+
|
10
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
13
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_extract_text
|
17
|
+
extractor = Aspose::Cloud::OCR::Extractor.new
|
18
|
+
response = extractor.extract_text(image_file_name='ocr.png', folder='')
|
19
|
+
assert_instance_of(Hash, response)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_extract_text_from_local_file
|
23
|
+
extractor = Aspose::Cloud::OCR::Extractor.new
|
24
|
+
response = extractor.extract_text_from_local_file(local_file='../Data/barcodeQR.png',language='english',use_default_dictionaries=true)
|
25
|
+
assert_instance_of(Hash, response)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_extract_text_from_url
|
29
|
+
extractor = Aspose::Cloud::OCR::Extractor.new
|
30
|
+
url = "http://cdns2.freepik.com/free-photo/colorful-curves-sample-text-vector_21-14522518.jpg"
|
31
|
+
response = extractor.extract_text_from_url(url,language='english',use_default_dictionaries=false)
|
32
|
+
assert_instance_of(Hash, response)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require_relative '../../lib/asposecloud'
|
4
|
+
|
5
|
+
class AnnotationEditorTests < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
file = File.read('../setup.json')
|
9
|
+
data = JSON.parse(file)
|
10
|
+
|
11
|
+
Aspose::Cloud::Common::AsposeApp.app_key = data['app_key']
|
12
|
+
Aspose::Cloud::Common::AsposeApp.app_sid = data['app_sid']
|
13
|
+
Aspose::Cloud::Common::AsposeApp.output_location = data['output_location']
|
14
|
+
Aspose::Cloud::Common::Product.set_base_product_uri(data['product_uri'])
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get number of annotations on a specified document page
|
18
|
+
def test_get_annotations_count
|
19
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
20
|
+
response = annotation_editor.get_annotations_count(page_number=1)
|
21
|
+
assert_equal true, response>=0
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get a specfied annotation on a specified document page
|
25
|
+
def test_get_annotation
|
26
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
27
|
+
response = annotation_editor.get_annotation(page_number=1, annotation_index=1)
|
28
|
+
assert_instance_of(Hash, response)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get list of all the annotations on a specified document page
|
32
|
+
def test_get_all_annotation
|
33
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
34
|
+
response = annotation_editor.get_all_annotation(page_number=1)
|
35
|
+
assert_instance_of(Array, response)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Get total number of Bookmarks in a Pdf document
|
39
|
+
def test_get_bookmarks_count
|
40
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('test_annotation.pdf')
|
41
|
+
response = annotation_editor.get_bookmarks_count()
|
42
|
+
assert_equal true, response>=0
|
43
|
+
end
|
44
|
+
|
45
|
+
# Get number of child bookmarks in a specfied parent bookmark
|
46
|
+
def test_get_child_bookmarks_count
|
47
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('test_annotation.pdf')
|
48
|
+
response = annotation_editor.get_child_bookmarks_count(parent=1)
|
49
|
+
assert_equal true, response>=0
|
50
|
+
end
|
51
|
+
|
52
|
+
# Get a specfied Bookmark from a PDF document
|
53
|
+
def test_get_bookmark
|
54
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('test_annotation.pdf')
|
55
|
+
response = annotation_editor.get_bookmark(bookmark_index=1)
|
56
|
+
assert_instance_of(Hash, response)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get a specfied Child Bookmark from a PDF document
|
60
|
+
def test_get_child_bookmark
|
61
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('test_annotation.pdf')
|
62
|
+
response = annotation_editor.get_child_bookmark(parent_index=1, child_index=1)
|
63
|
+
assert_instance_of(Hash, response)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Get list of all the bookmarks in pdf
|
67
|
+
def test_get_all_bookmarks
|
68
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
69
|
+
response = annotation_editor.get_all_bookmarks()
|
70
|
+
assert_instance_of(Array, response)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Get total number of Attachments in a Pdf document
|
74
|
+
def test_get_attachments_count
|
75
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('attachment.pdf')
|
76
|
+
response = annotation_editor.get_attachments_count()
|
77
|
+
assert_equal true, response>=0
|
78
|
+
end
|
79
|
+
|
80
|
+
# Get a specfied Attachment from a PDF document
|
81
|
+
def test_get_attachment
|
82
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('attachment.pdf')
|
83
|
+
response = annotation_editor.get_attachment(attachment_index=1)
|
84
|
+
assert_instance_of(Hash, response)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Get list of all the attachments in pdf
|
88
|
+
def test_get_all_attachments
|
89
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('attachment.pdf')
|
90
|
+
response = annotation_editor.get_all_attachments()
|
91
|
+
assert_instance_of(Array, response)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Download a specfied Attachment from a PDF document
|
95
|
+
def test_download_attachment
|
96
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('attachment.pdf')
|
97
|
+
response = annotation_editor.download_attachment(attachment_index=1)
|
98
|
+
assert_equal true, File.exist?('../Output/License.rtf')
|
99
|
+
end
|
100
|
+
|
101
|
+
# Get total number of Links in a Pdf document
|
102
|
+
def test_get_links_count
|
103
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
104
|
+
response = annotation_editor.get_links_count(page_number=1)
|
105
|
+
assert_equal true, response>=0
|
106
|
+
end
|
107
|
+
|
108
|
+
# Get a specfied link on a specified document page
|
109
|
+
def test_get_link
|
110
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
111
|
+
response = annotation_editor.get_link(page_number=2, link_index=1)
|
112
|
+
assert_instance_of(Hash, response)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Get list of all the links on a specified document page
|
116
|
+
def test_get_all_links
|
117
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('Test.pdf')
|
118
|
+
response = annotation_editor.get_all_links(page_number=1)
|
119
|
+
assert_instance_of(Array, response)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Checks whether selected bookmark is parent or child Gets a specfied child Bookmark for selected parent bookmark in Pdf document
|
123
|
+
def test_is_child_bookmark
|
124
|
+
annotation_editor = Aspose::Cloud::Pdf::AnnotationEditor.new('test_annotation.pdf')
|
125
|
+
response = annotation_editor.is_child_bookmark(bookmark_index=1)
|
126
|
+
assert_instance_of(Hash, response)
|
127
|
+
end
|
128
|
+
end
|