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
@@ -0,0 +1,120 @@
|
|
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_get_sections
|
17
|
+
# Create object of folder class
|
18
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
19
|
+
response = folder.upload_file '../Data/test_multi_pages.docx'
|
20
|
+
assert_equal true, response
|
21
|
+
|
22
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
23
|
+
response = extractor.get_sections()
|
24
|
+
assert_instance_of(Hash, response)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_get_section
|
28
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
29
|
+
response = extractor.get_section(section_id=1)
|
30
|
+
assert_instance_of(Hash, response)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_get_paragraphs
|
34
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
35
|
+
response = extractor.get_paragraphs()
|
36
|
+
assert_instance_of(Hash, response)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_get_paragraph
|
40
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
41
|
+
response = extractor.get_paragraph(para_id=1)
|
42
|
+
assert_instance_of(Hash, response)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_get_paragraph_run
|
46
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
47
|
+
response = extractor.get_paragraph_run(para_id=1, run_index=1)
|
48
|
+
assert_instance_of(Hash, response)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_get_paragraph_run_font
|
52
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
53
|
+
response = extractor.get_paragraph_run_font(para_id=1, run_index=1)
|
54
|
+
assert_instance_of(Hash, response)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_get_mail_merge_fields
|
58
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
59
|
+
response = extractor.get_mail_merge_fields()
|
60
|
+
assert_instance_of(Hash, response)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_get_text
|
64
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
65
|
+
response = extractor.get_text()
|
66
|
+
assert_instance_of(Array, response)
|
67
|
+
end
|
68
|
+
=end
|
69
|
+
def test_get_ole_data
|
70
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
71
|
+
assert_nothing_thrown 'Error' do
|
72
|
+
extractor.get_ole_data(ole_index=0, ole_format='png')
|
73
|
+
end
|
74
|
+
assert_equal true, File.exist?('../Output/test_multi_pages_1.png')
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_get_image_data
|
78
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
79
|
+
assert_nothing_thrown 'Error' do
|
80
|
+
extractor.get_image_data(image_index=1, image_format='png')
|
81
|
+
end
|
82
|
+
assert_equal true, File.exist?('../Output/test_multi_pages_1.png')
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_convert_drawing_object
|
86
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
87
|
+
assert_nothing_thrown 'Error' do
|
88
|
+
extractor.convert_drawing_object(object_index=1, render_format='png')
|
89
|
+
end
|
90
|
+
assert_equal true, File.exist?('../Output/test_multi_pages_1.png')
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_get_drawing_object_list
|
94
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
95
|
+
response = extractor.get_drawing_object_list()
|
96
|
+
assert_instance_of(Array, response)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_get_drawing_object
|
100
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
101
|
+
assert_nothing_thrown 'Error' do
|
102
|
+
extractor.get_drawing_object(object_uri='', output_path='')
|
103
|
+
end
|
104
|
+
assert_equal true, File.exist?('../Output/test_multi_pages_1.png')
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_get_drawing_objects
|
108
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
109
|
+
assert_nothing_thrown 'Error' do
|
110
|
+
extractor.get_drawing_objects(object_uri='', output_path='')
|
111
|
+
end
|
112
|
+
assert_equal true, File.exist?('../Output/test_multi_pages_1.png')
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_get_stats
|
116
|
+
extractor = Aspose::Cloud::Words::Extractor.new('test_multi_pages.docx')
|
117
|
+
response = extractor.get_stats()
|
118
|
+
assert_instance_of(Hash, response)
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require_relative '../../lib/asposecloud'
|
3
|
+
|
4
|
+
class MailMergeTests < 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
|
+
# Executes mail merge with/without regions
|
17
|
+
def test_execute_mail_merge
|
18
|
+
# Create object of folder class
|
19
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
20
|
+
response = folder.upload_file '../Data/mail_merge_regions.docx'
|
21
|
+
assert_equal true, response
|
22
|
+
|
23
|
+
str_xml = '<?xml version="1.0" encoding="utf-8"?>
|
24
|
+
<Orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="OrdersSchema.xsd">
|
25
|
+
<Item>
|
26
|
+
<Name>BBQ Chicken Pizza</Name>
|
27
|
+
<Price>6.00</Price>
|
28
|
+
<Quantity>1</Quantity>
|
29
|
+
<ItemTotal>6.00</ItemTotal>
|
30
|
+
</Item>
|
31
|
+
<Item>
|
32
|
+
<Name>1.5 Litre Coke</Name>
|
33
|
+
<Price>4.00</Price>
|
34
|
+
<Quantity>2</Quantity>
|
35
|
+
<ItemTotal>8.00</ItemTotal>
|
36
|
+
</Item>
|
37
|
+
<Item>
|
38
|
+
<Name>Hawaiian Pizza</Name>
|
39
|
+
<Price>4.00</Price>
|
40
|
+
<Quantity>1</Quantity>
|
41
|
+
<ItemTotal>4.00</ItemTotal>
|
42
|
+
</Item>
|
43
|
+
<Item>
|
44
|
+
<Name>Fries</Name>
|
45
|
+
<Price>1.00</Price>
|
46
|
+
<Quantity>2</Quantity>
|
47
|
+
<ItemTotal>2.00</ItemTotal>
|
48
|
+
</Item>
|
49
|
+
</Orders>'
|
50
|
+
|
51
|
+
mail_merge = Aspose::Cloud::Words::MailMerge.new('mail_merge_regions.docx')
|
52
|
+
assert_nothing_thrown 'Error' do
|
53
|
+
mail_merge.execute_mail_merge(str_xml, with_regions=true)
|
54
|
+
end
|
55
|
+
assert_equal true, File.exist?('../Output/mail_merge_regions.docx')
|
56
|
+
end
|
57
|
+
|
58
|
+
# Executes mail merge with template
|
59
|
+
def test_execute_template
|
60
|
+
# Create object of folder class
|
61
|
+
folder = Aspose::Cloud::AsposeStorage::Folder.new
|
62
|
+
response = folder.upload_file '../Data/mail_merge_template.docx'
|
63
|
+
assert_equal true, response
|
64
|
+
|
65
|
+
str_xml = '<?xml version="1.0" encoding="utf-8" ?>
|
66
|
+
<Orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="OrdersSchema.xsd">
|
67
|
+
<Order>
|
68
|
+
<Address>
|
69
|
+
<Number>23</Number>
|
70
|
+
<Street>Nelson Street</Street>
|
71
|
+
<Suburb>Howick</Suburb>
|
72
|
+
<City>Auckland</City>
|
73
|
+
</Address>
|
74
|
+
<PhoneNumber>543 1234</PhoneNumber>
|
75
|
+
<Date>03/01/2010</Date>
|
76
|
+
<Total>14.00</Total>
|
77
|
+
<Item>
|
78
|
+
<Name>BBQ Chicken Pizza</Name>
|
79
|
+
<Price>6.00</Price>
|
80
|
+
<Quantity>1</Quantity>
|
81
|
+
<ItemTotal>6.00</ItemTotal>
|
82
|
+
</Item>
|
83
|
+
<Item>
|
84
|
+
<Name>1.5 Litre Coke</Name>
|
85
|
+
<Price>4.00</Price>
|
86
|
+
<Quantity>2</Quantity>
|
87
|
+
<ItemTotal>8.00</ItemTotal>
|
88
|
+
</Item>
|
89
|
+
</Order>
|
90
|
+
<Order>
|
91
|
+
<Address>
|
92
|
+
<Number>10</Number>
|
93
|
+
<Street>Parkville Avenue</Street>
|
94
|
+
<Suburb>Pakuranga</Suburb>
|
95
|
+
<City>Auckland</City>
|
96
|
+
</Address>
|
97
|
+
<PhoneNumber>548 7342</PhoneNumber>
|
98
|
+
<Date>05/03/2010</Date>
|
99
|
+
<Total>6.00</Total>
|
100
|
+
<Item>
|
101
|
+
<Name>Hawaiian Pizza</Name>
|
102
|
+
<Price>4.00</Price>
|
103
|
+
<Quantity>1</Quantity>
|
104
|
+
<ItemTotal>4.00</ItemTotal>
|
105
|
+
</Item>
|
106
|
+
<Item>
|
107
|
+
<Name>Fries</Name>
|
108
|
+
<Price>1.00</Price>
|
109
|
+
<Quantity>2</Quantity>
|
110
|
+
<ItemTotal>2.00</ItemTotal>
|
111
|
+
</Item>
|
112
|
+
</Order>
|
113
|
+
</Orders>'
|
114
|
+
mail_merge = Aspose::Cloud::Words::MailMerge.new('mail_merge_template.docx')
|
115
|
+
assert_nothing_thrown 'Error' do
|
116
|
+
mail_merge.execute_template(str_xml)
|
117
|
+
end
|
118
|
+
assert_equal true, File.exist?('../Output/mail_merge_template.docx')
|
119
|
+
end
|
120
|
+
end
|
data/Tests/setup.json
ADDED
data/lib/Barcode/builder.rb
CHANGED
@@ -1,26 +1,33 @@
|
|
1
|
-
# Copyright (c) Aspose 2002-2014. All Rights Reserved.
|
2
|
-
#
|
3
|
-
# LICENSE: This program is free software; you can redistribute it and/or
|
4
|
-
# modify it under the terms of the GNU General Public License
|
5
|
-
# as published by the Free Software Foundation; either version 3
|
6
|
-
# of the License, or (at your option) any later version.
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
# You should have received a copy of the GNU General Public License
|
12
|
-
# along with this program. If not, see <http://opensource.org/licenses/gpl-3.0.html>;.
|
13
|
-
#
|
14
|
-
# @package Aspose_Cloud_SDK_For_Ruby
|
15
|
-
# @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
|
16
|
-
# @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
|
17
|
-
|
18
1
|
module Aspose
|
19
2
|
module Cloud
|
20
3
|
module Barcode
|
21
4
|
class Builder
|
22
|
-
def save(code_text, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='', x_resolution=nil, y_resolution=nil, x_dimension=nil, y_dimension=nil)
|
23
5
|
|
6
|
+
=begin
|
7
|
+
Create Barcode with different options
|
8
|
+
@param string code_text Text to encode inside barcode.
|
9
|
+
@param string symbology Type of barcode.
|
10
|
+
@param string image_format Returns an image in specified format.
|
11
|
+
@param string remote_folder Folder with barcode image.
|
12
|
+
@param string x_resolution Resolution along X in dpi.
|
13
|
+
@param string y_resolution Resolution along Y in dpi.
|
14
|
+
@param string x_dimension Width of barcode unit (bar or space).
|
15
|
+
@param string y_dimension Height of barcode unit (for 2D barcodes).
|
16
|
+
@param string code_location Location of the code.
|
17
|
+
@param string gr_unit Measurement of basic barcode parameters.
|
18
|
+
@param string auto_size Sets if barcode's size will be updated automatically.
|
19
|
+
@param string bar_height Height of the bar.
|
20
|
+
@param string image_height Sets height of the image.
|
21
|
+
@param string image_width Sets width of the image.
|
22
|
+
@param string image_quality Sets quality of the image.
|
23
|
+
@param string rotation_angle Angle of barcode orientation.
|
24
|
+
@param string top_margin Margin between barcode and top image border.
|
25
|
+
@param string bottom_margin Margin between barcode and bottom image border.
|
26
|
+
@param string left_margin Margin between barcode and left image border.
|
27
|
+
@param string right_margin Margin between barcode and right image border.
|
28
|
+
@param string enable_checksum Sets if checksum will be added to barcode image.
|
29
|
+
=end
|
30
|
+
def save(code_text, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='', x_resolution=nil, y_resolution=nil, x_dimension=nil, y_dimension=nil, code_location='', gr_unit='', auto_size='', bar_height=nil, image_height=nil, image_width=nil, image_quality=nil, rotation_angle=nil, top_margin=nil, bottom_margin=nil, left_margin=nil, right_margin=nil, enable_checksum='')
|
24
31
|
raise 'code_text can not be empty.' if code_text.empty?
|
25
32
|
raise 'symbology can not be empty.' if symbology.empty?
|
26
33
|
raise 'image_format can not be empty.' if image_format.empty?
|
@@ -30,8 +37,20 @@ module Aspose
|
|
30
37
|
str_uri = "#{str_uri}&resolutionX=#{x_resolution}" unless x_resolution.nil?
|
31
38
|
str_uri = "#{str_uri}&resolutionY=#{y_resolution}" unless y_resolution.nil?
|
32
39
|
str_uri = "#{str_uri}&dimensionX=#{x_dimension}" unless x_dimension.nil?
|
33
|
-
str_uri = "#{str_uri}&dimensionY=#{y_dimension}" unless y_dimension.nil?
|
34
|
-
str_uri =
|
40
|
+
str_uri = "#{str_uri}&dimensionY=#{y_dimension}" unless y_dimension.nil?
|
41
|
+
str_uri = "#{str_uri}&codeLocation=#{code_location}" unless code_location.empty?
|
42
|
+
str_uri = "#{str_uri}&grUnit=#{gr_unit}" unless gr_unit.empty?
|
43
|
+
str_uri = "#{str_uri}&barHeight=#{bar_height}" unless bar_height.nil?
|
44
|
+
str_uri = "#{str_uri}&imageHeight=#{image_height}" unless image_height.nil?
|
45
|
+
str_uri = "#{str_uri}&imageWidth=#{image_width}" unless image_width.nil?
|
46
|
+
str_uri = "#{str_uri}&imageQuality=#{image_quality}" unless image_quality.nil?
|
47
|
+
str_uri = "#{str_uri}&rotAngle=#{rotation_angle}" unless rotation_angle.nil?
|
48
|
+
str_uri = "#{str_uri}&topMargin=#{top_margin}" unless top_margin.nil?
|
49
|
+
str_uri = "#{str_uri}&bottomMargin=#{bottom_margin}" unless bottom_margin.nil?
|
50
|
+
str_uri = "#{str_uri}&leftMargin=#{left_margin}" unless left_margin.nil?
|
51
|
+
str_uri = "#{str_uri}&rightMargin=#{right_margin}" unless right_margin.nil?
|
52
|
+
str_uri = "#{str_uri}&enableChecksum=#{enable_checksum}" unless enable_checksum.empty?
|
53
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
35
54
|
|
36
55
|
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
37
56
|
response = RestClient.get(signed_uri, :accept => 'application/json')
|
@@ -39,6 +58,237 @@ module Aspose
|
|
39
58
|
Aspose::Cloud::Common::Utils.save_file(response, output_path)
|
40
59
|
output_path
|
41
60
|
end
|
61
|
+
|
62
|
+
=begin
|
63
|
+
Create Barcode and Get Image as Stream
|
64
|
+
@param string code_text Text to encode inside barcode.
|
65
|
+
@param string symbology Type of barcode.
|
66
|
+
@param string image_format Returns an image in specified format.
|
67
|
+
@param string remote_folder Folder with barcode image.
|
68
|
+
=end
|
69
|
+
|
70
|
+
def generate_barcode_image_stream(code_text, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
71
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
72
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
73
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
74
|
+
|
75
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
76
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}"
|
77
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
78
|
+
|
79
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
80
|
+
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
|
81
|
+
end
|
82
|
+
|
83
|
+
=begin
|
84
|
+
Generate Barcode with Appropriate Code Text Location
|
85
|
+
@param string code_text Text to encode inside barcode.
|
86
|
+
@param string symbology Type of barcode.
|
87
|
+
@param string image_format Returns an image in specified format.
|
88
|
+
@param string code_location Location of the code.
|
89
|
+
@param string remote_folder Folder with barcode image.
|
90
|
+
=end
|
91
|
+
def set_barcode_code_location(code_text, code_location, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
92
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
93
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
94
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
95
|
+
raise 'code_location can not be empty.' if code_location.empty?
|
96
|
+
|
97
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
98
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&codeLocation=#{code_location}"
|
99
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
100
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
101
|
+
response = RestClient.get(signed_uri, :accept => 'application/json')
|
102
|
+
|
103
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
104
|
+
Aspose::Cloud::Common::Utils.save_file(response, output_path)
|
105
|
+
end
|
106
|
+
=begin
|
107
|
+
Generate Barcode with Checksum Option
|
108
|
+
@param string code_text Text to encode inside barcode.
|
109
|
+
@param string symbology Type of barcode.
|
110
|
+
@param string image_format Returns an image in specified format.
|
111
|
+
@param string checksum Sets if checksum will be added to barcode image.
|
112
|
+
@param string remote_folder Folder with barcode image.
|
113
|
+
=end
|
114
|
+
def set_barcode_checksum(code_text, checksum, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
115
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
116
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
117
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
118
|
+
raise 'checksum can not be empty.' if checksum.empty?
|
119
|
+
|
120
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
121
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&enableChecksum=#{checksum}"
|
122
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
123
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
124
|
+
|
125
|
+
response = RestClient.get(signed_uri, :accept => 'application/json')
|
126
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
127
|
+
Aspose::Cloud::Common::Utils.save_file(response, output_path)
|
128
|
+
end
|
129
|
+
|
130
|
+
=begin
|
131
|
+
Set Barcode Image Height, Width and Quality along with Auto Size Option
|
132
|
+
@param string code_text Text to encode inside barcode.
|
133
|
+
@param string symbology Type of barcode.
|
134
|
+
@param string image_format Returns an image in specified format.
|
135
|
+
@param string image_height Sets height of the image.
|
136
|
+
@param string image_width Sets width of the image.
|
137
|
+
@param string image_quality Sets quality of the image.
|
138
|
+
@param string rotation_angle Angle of barcode orientation.
|
139
|
+
@param string auto_size Sets if barcode's size will be updated automatically.
|
140
|
+
@param string remote_folder Folder with barcode image.
|
141
|
+
=end
|
142
|
+
def set_barcode_height_width(code_text, height, width, quality, auto_size, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
143
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
144
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
145
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
146
|
+
raise 'height can not be empty.' if height.nil?
|
147
|
+
raise 'width can not be empty.' if width.nil?
|
148
|
+
raise 'quality can not be empty.' if quality.nil?
|
149
|
+
raise 'auto_size can not be empty.' if auto_size.nil?
|
150
|
+
|
151
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
152
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&imageHeight=#{height}&imageWidth=#{width}&imageQuality=#{quality}&autoSize=#{auto_size}"
|
153
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
154
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
155
|
+
|
156
|
+
response = RestClient.get(signed_uri, :accept => 'application/json')
|
157
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
158
|
+
Aspose::Cloud::Common::Utils.save_file(response, output_path)
|
159
|
+
end
|
160
|
+
|
161
|
+
=begin
|
162
|
+
Rotate Barcode Image with Suitable Angle
|
163
|
+
@param string code_text Text to encode inside barcode.
|
164
|
+
@param string symbology Type of barcode.
|
165
|
+
@param string image_format Returns an image in specified format.
|
166
|
+
@param number rotation_angle Angle of barcode orientation.
|
167
|
+
@param string remote_folder Folder with barcode image.
|
168
|
+
=end
|
169
|
+
def set_barcode_angle(code_text, rotation_angle, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
170
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
171
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
172
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
173
|
+
raise 'rotation_angle can not be empty.' if rotation_angle.nil?
|
174
|
+
|
175
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
176
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&rotAngle=#{rotation_angle}"
|
177
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
178
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
179
|
+
|
180
|
+
response = RestClient.get(signed_uri, :accept => 'application/json')
|
181
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
182
|
+
Aspose::Cloud::Common::Utils.save_file(response, output_path)
|
183
|
+
end
|
184
|
+
|
185
|
+
=begin
|
186
|
+
Set Barcode Image Margin
|
187
|
+
@param string code_text Text to encode inside barcode.
|
188
|
+
@param string symbology Type of barcode.
|
189
|
+
@param string image_format Returns an image in specified format.
|
190
|
+
@param string top_margin Margin between barcode and top image border.
|
191
|
+
@param string bottom_margin Margin between barcode and bottom image border.
|
192
|
+
@param string left_margin Margin between barcode and left image border.
|
193
|
+
@param string right_margin Margin between barcode and right image border.
|
194
|
+
@param string remote_folder Folder with barcode image.
|
195
|
+
=end
|
196
|
+
def set_barcode_margin(code_text, top_margin, bottom_margin, left_margin, right_margin, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
197
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
198
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
199
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
200
|
+
raise 'top_margin can not be empty.' if top_margin.nil?
|
201
|
+
raise 'bottom_margin can not be empty.' if bottom_margin.nil?
|
202
|
+
raise 'left_margin can not be empty.' if left_margin.nil?
|
203
|
+
raise 'right_margin can not be empty.' if right_margin.nil?
|
204
|
+
|
205
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
206
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&topMargin=#{top_margin}&bottomMargin=#{bottom_margin}&leftMargin=#{left_margin}&rightMargin=#{right_margin}"
|
207
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
208
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
209
|
+
|
210
|
+
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
|
211
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
212
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)
|
213
|
+
end
|
214
|
+
|
215
|
+
=begin
|
216
|
+
Set Barcode Image Resolution
|
217
|
+
@param string code_text Text to encode inside barcode.
|
218
|
+
@param string symbology Type of barcode.
|
219
|
+
@param string image_format Returns an image in specified format.
|
220
|
+
@param string x_resolution Resolution along X in dpi.
|
221
|
+
@param string y_resolution Resolution along Y in dpi.
|
222
|
+
@param string remote_folder Folder with barcode image.
|
223
|
+
=end
|
224
|
+
def set_barcode_resolution(code_text, x_resolution, y_resolution, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
225
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
226
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
227
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
228
|
+
raise 'x_resolution can not be empty.' if x_resolution.nil?
|
229
|
+
raise 'y_resolution can not be empty.' if y_resolution.nil?
|
230
|
+
|
231
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
232
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&resolutionX=#{x_resolution}&resolutionY=#{y_resolution}"
|
233
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
234
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
235
|
+
|
236
|
+
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
|
237
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
238
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)
|
239
|
+
end
|
240
|
+
|
241
|
+
=begin
|
242
|
+
Set Height of the Bars in the Barcode Image
|
243
|
+
@param string code_text Text to encode inside barcode.
|
244
|
+
@param string symbology Type of barcode.
|
245
|
+
@param string image_format Returns an image in specified format.
|
246
|
+
@param number height Height of the bar.
|
247
|
+
@param string gr_unit Measurement of basic barcode parameters.
|
248
|
+
@param string remote_folder Folder with barcode image.
|
249
|
+
=end
|
250
|
+
def set_barcode_height(code_text, height, gr_unit, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
251
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
252
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
253
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
254
|
+
raise 'height can not be empty.' if height.nil?
|
255
|
+
raise 'gr_unit can not be empty.' if gr_unit.empty?
|
256
|
+
|
257
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
258
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&barHeight=#{height}&grUnit=#{gr_unit}"
|
259
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
260
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
261
|
+
|
262
|
+
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
|
263
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
264
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)
|
265
|
+
end
|
266
|
+
|
267
|
+
=begin
|
268
|
+
Set X and Y Dimensions of a Barcode
|
269
|
+
@param string code_text Text to encode inside barcode.
|
270
|
+
@param string symbology Type of barcode.
|
271
|
+
@param string image_format Returns an image in specified format.
|
272
|
+
@param number x_dimension Width of barcode unit (bar or space).
|
273
|
+
@param number y_dimension Height of barcode unit (for 2D barcodes).
|
274
|
+
@param string remote_folder Folder with barcode image.
|
275
|
+
=end
|
276
|
+
def set_barcode_dimensions(code_text, x_dimension, y_dimension, symbology='QR', image_format='png', remote_folder='', storage_type='Aspose', storage_name='')
|
277
|
+
raise 'code_text can not be empty.' if code_text.empty?
|
278
|
+
raise 'symbology can not be empty.' if symbology.empty?
|
279
|
+
raise 'image_format can not be empty.' if image_format.empty?
|
280
|
+
raise 'x_dimension can not be empty.' if x_dimension.nil?
|
281
|
+
raise 'y_dimension can not be empty.' if y_dimension.nil?
|
282
|
+
|
283
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/generate?"
|
284
|
+
str_uri = "#{str_uri}text=#{code_text}&type=#{symbology}&format=#{image_format}&dimensionX=#{x_dimension}&dimensionY=#{y_dimension}"
|
285
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)
|
286
|
+
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
287
|
+
|
288
|
+
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
|
289
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}barcode#{symbology}.#{image_format}"
|
290
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream, output_path)
|
291
|
+
end
|
42
292
|
end
|
43
293
|
end
|
44
294
|
end
|