asposecloud 1.0.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/Words/extractor.rb
CHANGED
@@ -1,20 +1,3 @@
|
|
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 Words
|
@@ -26,7 +9,93 @@ module Aspose
|
|
26
9
|
end
|
27
10
|
|
28
11
|
=begin
|
29
|
-
|
12
|
+
Get a List of Sections from a Word Document
|
13
|
+
=end
|
14
|
+
def get_sections(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
15
|
+
str_uri = "#{@base_uri}/sections"
|
16
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
17
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
18
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Sections']
|
19
|
+
end
|
20
|
+
|
21
|
+
=begin
|
22
|
+
Get a specific Section from a Word Document
|
23
|
+
@param number section_id ID of the section.
|
24
|
+
=end
|
25
|
+
def get_section(section_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
26
|
+
raise 'section_id not specified.' if section_id.nil?
|
27
|
+
|
28
|
+
str_uri = "#{@base_uri}/sections/#{section_id}"
|
29
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
30
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
31
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Section']
|
32
|
+
end
|
33
|
+
|
34
|
+
=begin
|
35
|
+
Get a List of Paragraphs from a Word Document
|
36
|
+
=end
|
37
|
+
def get_paragraphs(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
38
|
+
str_uri = "#{@base_uri}/paragraphs"
|
39
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
40
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
41
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Paragraphs']
|
42
|
+
end
|
43
|
+
|
44
|
+
=begin
|
45
|
+
Get a Paragraph from a Word Document
|
46
|
+
@param number para_id ID of the paragraph.
|
47
|
+
=end
|
48
|
+
def get_paragraph(para_id, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
49
|
+
raise 'para_id not specified.' if para_id.nil?
|
50
|
+
|
51
|
+
str_uri = "#{@base_uri}/paragraphs/#{para_id}"
|
52
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
53
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
54
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Paragraph']
|
55
|
+
end
|
56
|
+
|
57
|
+
=begin
|
58
|
+
Get a specific Run of a Paragraph from a Word Document
|
59
|
+
@param number para_id ID of the paragraph.
|
60
|
+
@param number run_index Index of the praragraph run.
|
61
|
+
=end
|
62
|
+
def get_paragraph_run(para_id, run_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
63
|
+
raise 'para_id not specified.' if para_id.nil?
|
64
|
+
raise 'run_index not specified.' if run_index.nil?
|
65
|
+
|
66
|
+
str_uri = "#{@base_uri}/paragraphs/#{para_id}/runs/#{run_index}"
|
67
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
68
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
69
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Run']
|
70
|
+
end
|
71
|
+
|
72
|
+
=begin
|
73
|
+
Get Font Information of a Run from a Word Document
|
74
|
+
@param number para_id ID of the paragraph.
|
75
|
+
@param number run_index Index of the praragraph run.
|
76
|
+
=end
|
77
|
+
def get_paragraph_run_font(para_id, run_index, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
78
|
+
raise 'para_id not specified.' if para_id.nil?
|
79
|
+
raise 'run_index not specified.' if run_index.nil?
|
80
|
+
|
81
|
+
str_uri = "#{@base_uri}/paragraphs/#{para_id}/runs/#{run_index}/font"
|
82
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
83
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
84
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['Font']
|
85
|
+
end
|
86
|
+
|
87
|
+
=begin
|
88
|
+
Get All Merge Field Names from a Word Document
|
89
|
+
=end
|
90
|
+
def get_mail_merge_fields(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
91
|
+
str_uri = "#{@base_uri}/mailMergeFieldNames"
|
92
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
93
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
94
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['FieldNames']
|
95
|
+
end
|
96
|
+
|
97
|
+
=begin
|
98
|
+
Gets Text items list from document
|
30
99
|
=end
|
31
100
|
def get_text(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
32
101
|
str_uri = "#{@base_uri}/textItems"
|
@@ -36,9 +105,9 @@ module Aspose
|
|
36
105
|
end
|
37
106
|
|
38
107
|
=begin
|
39
|
-
|
40
|
-
|
41
|
-
|
108
|
+
Get the OLE drawing object from document
|
109
|
+
@param number index Index of he OLE object.
|
110
|
+
@param string ole_format Return file format.
|
42
111
|
=end
|
43
112
|
|
44
113
|
def get_ole_data(ole_index, ole_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
@@ -56,9 +125,9 @@ module Aspose
|
|
56
125
|
end
|
57
126
|
|
58
127
|
=begin
|
59
|
-
|
60
|
-
|
61
|
-
|
128
|
+
Get the Image drawing object from document
|
129
|
+
@param number image_index Index of the image.
|
130
|
+
@param string image_format Return image format.
|
62
131
|
=end
|
63
132
|
def get_image_data(image_index, image_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
64
133
|
raise 'image_index not specified.' if image_index.nil?
|
@@ -75,9 +144,9 @@ module Aspose
|
|
75
144
|
end
|
76
145
|
|
77
146
|
=begin
|
78
|
-
|
79
|
-
|
80
|
-
|
147
|
+
Convert drawing object to image
|
148
|
+
@param number object_index Index of the object.
|
149
|
+
@param string render_format Return file format.
|
81
150
|
=end
|
82
151
|
def convert_drawing_object(object_index, render_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
83
152
|
raise 'object_index not specified.' if object_index.nil?
|
@@ -94,7 +163,7 @@ module Aspose
|
|
94
163
|
end
|
95
164
|
|
96
165
|
=begin
|
97
|
-
|
166
|
+
Get the List of drawing object from document
|
98
167
|
=end
|
99
168
|
def get_drawing_object_list(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
100
169
|
str_uri = "#{@base_uri}/drawingObjects"
|
@@ -104,9 +173,9 @@ module Aspose
|
|
104
173
|
end
|
105
174
|
|
106
175
|
=begin
|
107
|
-
|
108
|
-
|
109
|
-
|
176
|
+
Get the drawing object from document
|
177
|
+
@param string object_uri URI of the object.
|
178
|
+
@param string output_path Path of the output file.
|
110
179
|
=end
|
111
180
|
|
112
181
|
def get_drawing_object(object_uri, output_path, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
@@ -137,8 +206,8 @@ module Aspose
|
|
137
206
|
end
|
138
207
|
|
139
208
|
=begin
|
140
|
-
|
141
|
-
|
209
|
+
Get the List of drawing object from document
|
210
|
+
@param string output_path Path of the output file.
|
142
211
|
=end
|
143
212
|
def get_drawing_objects(output_path, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
144
213
|
raise 'output_path not specified.' if output_path.empty?
|
@@ -147,6 +216,16 @@ module Aspose
|
|
147
216
|
self.get_drawing_object(obj['link']['Href'],output_path)
|
148
217
|
}
|
149
218
|
end
|
219
|
+
|
220
|
+
=begin
|
221
|
+
Get Word and Paragraph Count from Document
|
222
|
+
=end
|
223
|
+
def get_stats(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
224
|
+
str_uri = "#{@base_uri}/statistics"
|
225
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
226
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
227
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['StatData']
|
228
|
+
end
|
150
229
|
end
|
151
230
|
end
|
152
231
|
end
|
data/lib/Words/mail_merge.rb
CHANGED
@@ -1,20 +1,3 @@
|
|
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 Words
|
@@ -43,10 +26,9 @@ module Aspose
|
|
43
26
|
valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(JSON.parse(response_stream)['Document']['FileName'],@filename,folder_name,storage_name,storage_type) : valid_output
|
44
27
|
end
|
45
28
|
|
46
|
-
|
47
29
|
=begin
|
48
|
-
|
49
|
-
|
30
|
+
Executes mail merge with template.
|
31
|
+
@param string str_xml
|
50
32
|
=end
|
51
33
|
def execute_template(str_xml, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
52
34
|
raise 'str_xml not specified.' if str_xml.empty?
|
@@ -15,20 +15,8 @@
|
|
15
15
|
# @author Assad Mahmood Qazi <assad.mahmood@aspose.com>
|
16
16
|
# @link https://github.com/asposeforcloud/Aspose_Cloud_SDK_For_Ruby/tree/revamp
|
17
17
|
|
18
|
-
|
19
|
-
require_relative '
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
Aspose::Cloud::Common::AsposeApp.app_key = '8356c76c7412f32bb85ae7472e842da4'
|
24
|
-
Aspose::Cloud::Common::AsposeApp.app_sid = '8EB6E644-4A40-4B50-8012-135D1F8F7513'
|
25
|
-
Aspose::Cloud::Common::AsposeApp.output_location = './Output/'
|
26
|
-
Aspose::Cloud::Common::Product.set_base_product_uri('http://test.aspose.com/v1.1')
|
27
|
-
|
28
|
-
# Create object of word converter class
|
29
|
-
converter = Aspose::Cloud::Words::Converter.new('file_on_storage.doc')
|
30
|
-
|
31
|
-
converter.convert_local_file('./Data/test_convertlocal.docx','./Output/converted_file.pdf','pdf')
|
32
|
-
assert_equal true, File.exist?('./Output/converted_file.pdf')
|
33
|
-
end
|
34
|
-
end
|
18
|
+
require_relative 'aspose_storage'
|
19
|
+
require_relative 'imaging/converter'
|
20
|
+
require_relative 'imaging/document'
|
21
|
+
require_relative 'imaging/image'
|
22
|
+
require_relative 'imaging/extractor'
|
data/lib/asposecloud.rb
CHANGED
@@ -26,4 +26,6 @@ require_relative 'aspose_words'
|
|
26
26
|
require_relative 'aspose_barcode'
|
27
27
|
require_relative 'aspose_ocr'
|
28
28
|
require_relative 'aspose_email'
|
29
|
-
require_relative 'aspose_tasks'
|
29
|
+
require_relative 'aspose_tasks'
|
30
|
+
require_relative 'aspose_imaging'
|
31
|
+
require_relative 'restclient'
|
data/lib/asposecloud/version.rb
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
module Aspose
|
2
|
+
module Cloud
|
3
|
+
module Imaging
|
4
|
+
class Converter
|
5
|
+
def initialize(filename)
|
6
|
+
@filename = filename
|
7
|
+
raise 'filename not specified.' if filename.empty?
|
8
|
+
@base_uri = Aspose::Cloud::Common::Product.product_uri + '/imaging/' + @filename
|
9
|
+
end
|
10
|
+
|
11
|
+
=begin
|
12
|
+
convert an image file to a different format
|
13
|
+
@param string input_file_path Path of the input file.
|
14
|
+
@param string output_filename Name of the output file.
|
15
|
+
@param string save_format Output file format.
|
16
|
+
=end
|
17
|
+
def convert_local_file(input_file_path, output_filename, save_format)
|
18
|
+
raise 'input_file_path not specified.' if input_file_path.empty?
|
19
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
20
|
+
raise 'save_format not specified.' if save_format.empty?
|
21
|
+
|
22
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/#{@filename}/saveAs?format=#{save_format}"
|
23
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
24
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json', :payload=>File.new(input_file_path, 'rb')})
|
25
|
+
|
26
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
27
|
+
|
28
|
+
if valid_output.empty?
|
29
|
+
save_format = 'zip' if save_format.eql?('html')
|
30
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}.#{save_format}"
|
31
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
32
|
+
end
|
33
|
+
valid_output
|
34
|
+
end
|
35
|
+
|
36
|
+
=begin
|
37
|
+
convert an image file to a fax
|
38
|
+
=end
|
39
|
+
def convert_tiff_to_fax(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
40
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/tiff/#{@filename}/toFax"
|
41
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
42
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
43
|
+
|
44
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
45
|
+
|
46
|
+
if valid_output.empty?
|
47
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{@filename}"
|
48
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
49
|
+
end
|
50
|
+
valid_output
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,301 @@
|
|
1
|
+
module Aspose
|
2
|
+
module Cloud
|
3
|
+
module Imaging
|
4
|
+
class Document
|
5
|
+
def initialize(filename)
|
6
|
+
@filename = filename
|
7
|
+
raise 'filename not specified.' if filename.empty?
|
8
|
+
@base_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/#{@filename}"
|
9
|
+
end
|
10
|
+
|
11
|
+
=begin
|
12
|
+
Get Document's properties
|
13
|
+
=end
|
14
|
+
def get_properties(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
15
|
+
str_uri = "#{@base_uri}/properties"
|
16
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
17
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
18
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))
|
19
|
+
end
|
20
|
+
|
21
|
+
=begin
|
22
|
+
Update BMP Image Properties
|
23
|
+
@param number bits_per_px Color depth.
|
24
|
+
@param number h_resolution New horizontal resolution.
|
25
|
+
@param number v_resolution New vertical resolution.
|
26
|
+
@param string output_path Path to updated file.
|
27
|
+
=end
|
28
|
+
def update_bmp_properties(bits_per_px, h_resolution, v_resolution, output_path,
|
29
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
30
|
+
str_uri = "#{@base_uri}/bmp"
|
31
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:bitsPerPixel=> bits_per_px,
|
32
|
+
:horizontalResolution=> h_resolution,
|
33
|
+
:verticalResolution=> v_resolution,
|
34
|
+
:outPath=> output_path})
|
35
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
36
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
37
|
+
|
38
|
+
response_stream = RestClient.get(signed_str_uri, {:content_type=>'application/json',
|
39
|
+
:accept=>'application/json'})
|
40
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
41
|
+
|
42
|
+
if valid_output.empty?
|
43
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_updated.bmp"
|
44
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
45
|
+
end
|
46
|
+
valid_output
|
47
|
+
end
|
48
|
+
|
49
|
+
=begin
|
50
|
+
Update BMP Image Properties without Storage
|
51
|
+
@param number input_file_path Path of the input file.
|
52
|
+
@param number bits_per_px Color depth.
|
53
|
+
@param number h_resolution New horizontal resolution.
|
54
|
+
@param string v_resolution New vertical resolution.
|
55
|
+
=end
|
56
|
+
def update_bmp_properties_local(input_file_path, bits_per_px, h_resolution, v_resolution,
|
57
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
58
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/bmp"
|
59
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:bitsPerPixel=> bits_per_px,
|
60
|
+
:horizontalResolution=> h_resolution,
|
61
|
+
:verticalResolution=> v_resolution})
|
62
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
63
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
64
|
+
|
65
|
+
response_stream = RestClient.post(signed_str_uri, File.new(input_file_path, 'rb'),
|
66
|
+
{:content_type=>'application/json', :accept=>'application/json'})
|
67
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
68
|
+
|
69
|
+
if valid_output.empty?
|
70
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(input_file_path)}_updated.bmp"
|
71
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
72
|
+
end
|
73
|
+
valid_output
|
74
|
+
end
|
75
|
+
|
76
|
+
=begin
|
77
|
+
Update GIF Image Properties
|
78
|
+
@param number bg_color_index Index of the background color.
|
79
|
+
@param number px_aspect_ratio Pixel aspect ratio.
|
80
|
+
@param boolean interlaced Specifies if image is interlaced.
|
81
|
+
@param string output_path Path to updated file.
|
82
|
+
=end
|
83
|
+
def update_gif_properties(bg_color_index, px_aspect_ratio, interlaced, output_path,
|
84
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
85
|
+
str_uri = "#{@base_uri}/gif"
|
86
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:backgroundColorIndex=> bg_color_index,
|
87
|
+
:pixelAspectRatio=> px_aspect_ratio,
|
88
|
+
:interlaced=> interlaced,
|
89
|
+
:outPath=> output_path})
|
90
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
91
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
92
|
+
|
93
|
+
response_stream = RestClient.get(signed_str_uri, {:content_type=>'application/json',
|
94
|
+
:accept=>'application/json'})
|
95
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
96
|
+
|
97
|
+
if valid_output.empty?
|
98
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_updated.gif"
|
99
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
100
|
+
end
|
101
|
+
valid_output
|
102
|
+
end
|
103
|
+
|
104
|
+
=begin
|
105
|
+
Update GIF Image Properties without Storage
|
106
|
+
@param string input_file_path Path of the input file.
|
107
|
+
@param number bg_color_index Index of the background color.
|
108
|
+
@param number px_aspect_ratio Pixel aspect ratio.
|
109
|
+
@param boolean interlaced Specifies if image is interlaced.
|
110
|
+
=end
|
111
|
+
def update_gif_properties_local(input_file_path, bg_color_index, px_aspect_ratio, interlaced,
|
112
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
113
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/gif"
|
114
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:backgroundColorIndex=> bg_color_index,
|
115
|
+
:pixelAspectRatio=> px_aspect_ratio,
|
116
|
+
:interlaced=> interlaced})
|
117
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
118
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
119
|
+
|
120
|
+
response_stream = RestClient.post(signed_str_uri, File.new(input_file_path, 'rb'),
|
121
|
+
{:content_type=>'application/json', :accept=>'application/json'})
|
122
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
123
|
+
|
124
|
+
if valid_output.empty?
|
125
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(input_file_path)}_updated.gif"
|
126
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
127
|
+
end
|
128
|
+
valid_output
|
129
|
+
end
|
130
|
+
|
131
|
+
=begin
|
132
|
+
Update JPG Image Properties
|
133
|
+
@param number quality Quality of image. From 0 to 100
|
134
|
+
@param string compression_type Compression type.
|
135
|
+
@param string output_path Path to updated file.
|
136
|
+
=end
|
137
|
+
def update_jpg_properties(quality, compression_type, output_path,
|
138
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
139
|
+
str_uri = "#{@base_uri}/jpg"
|
140
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:quality=> quality,
|
141
|
+
:compressionType=> compression_type,
|
142
|
+
:outPath=> output_path})
|
143
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
144
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
145
|
+
|
146
|
+
response_stream = RestClient.get(signed_str_uri, {:content_type=>'application/json',
|
147
|
+
:accept=>'application/json'})
|
148
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
149
|
+
|
150
|
+
if valid_output.empty?
|
151
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_updated.jpg"
|
152
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
153
|
+
end
|
154
|
+
valid_output
|
155
|
+
end
|
156
|
+
|
157
|
+
=begin
|
158
|
+
Update JPG Image Properties without Storage
|
159
|
+
@param string input_file_path Path of the file.
|
160
|
+
@param number quality Quality of image. From 0 to 100
|
161
|
+
@param string compression_type Compression type.
|
162
|
+
=end
|
163
|
+
def update_jpg_properties_local(input_file_path, quality, compression_type,
|
164
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
165
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/jpg"
|
166
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:quality=> quality,
|
167
|
+
:compressionType=> compression_type})
|
168
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
169
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
170
|
+
|
171
|
+
response_stream = RestClient.post(signed_str_uri, File.new(input_file_path, 'rb'),
|
172
|
+
{:content_type=>'application/json', :accept=>'application/json'})
|
173
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
174
|
+
|
175
|
+
if valid_output.empty?
|
176
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(input_file_path)}_updated.jpg"
|
177
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
178
|
+
end
|
179
|
+
valid_output
|
180
|
+
end
|
181
|
+
|
182
|
+
=begin
|
183
|
+
Update TIFF Image Properties
|
184
|
+
@param string compression Type of the compression.
|
185
|
+
@param string resolution_unit Resolution unit: none, inch, centimeter.
|
186
|
+
@param number new_width New image width.
|
187
|
+
@param number new_height New image height.
|
188
|
+
@param number horizontal_resolution Horizontal resolution.
|
189
|
+
@param number vertical_resolution Vertical resolution.
|
190
|
+
@param string output_path Path to updated file.
|
191
|
+
=end
|
192
|
+
def update_tiff_properties(compression, resolution_unit, new_width, new_height, horizontal_resolution, vertical_resolution, output_path,
|
193
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
194
|
+
str_uri = "#{@base_uri}/tiff"
|
195
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:resolutionUnit=> resolution_unit,
|
196
|
+
:compression=> compression,
|
197
|
+
:newWidth=> new_width,
|
198
|
+
:newHeight=> new_height,
|
199
|
+
:horizontalResolution=> horizontal_resolution,
|
200
|
+
:verticalResolution=> vertical_resolution,
|
201
|
+
:outPath=> output_path})
|
202
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
203
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
204
|
+
|
205
|
+
response_stream = RestClient.post(signed_str_uri, '', {:content_type=>'application/json',
|
206
|
+
:accept=>'application/json'})
|
207
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
208
|
+
|
209
|
+
if valid_output.empty?
|
210
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_updated.tiff"
|
211
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
212
|
+
end
|
213
|
+
valid_output
|
214
|
+
end
|
215
|
+
|
216
|
+
=begin
|
217
|
+
Update TIFF Image Properties without Storage
|
218
|
+
@param string input_file_path Path of the input file.
|
219
|
+
@param string resolution_unit Resolution unit: none, inch, centimeter.
|
220
|
+
@param number new_width New image width.
|
221
|
+
@param number new_height New image height.
|
222
|
+
@param number horizontal_resolution Horizontal resolution.
|
223
|
+
@param number vertical_resolution Vertical resolution.
|
224
|
+
=end
|
225
|
+
def update_tiff_properties_local(input_file_path, resolution_unit, new_width, new_height, horizontal_resolution, vertical_resolution, output_path,
|
226
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
227
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/tiff"
|
228
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:resolutionUnit=> resolution_unit,
|
229
|
+
:newWidth=> new_width,
|
230
|
+
:newHeight=> new_height,
|
231
|
+
:horizontalResolution=> horizontal_resolution,
|
232
|
+
:verticalResolution=> vertical_resolution,
|
233
|
+
:outPath=> output_path})
|
234
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
235
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
236
|
+
|
237
|
+
response_stream = RestClient.post(signed_str_uri, File.new(input_file_path, 'rb'),
|
238
|
+
{:content_type=>'application/json', :accept=>'application/json'})
|
239
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
240
|
+
|
241
|
+
if valid_output.empty?
|
242
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(input_file_path)}_updated.tiff"
|
243
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
244
|
+
end
|
245
|
+
valid_output
|
246
|
+
end
|
247
|
+
|
248
|
+
=begin
|
249
|
+
Update PSD Image Properties
|
250
|
+
@param number channels_count Count of channels.
|
251
|
+
@param string compression_method Compression method.
|
252
|
+
@param string output_path Path to updated file.
|
253
|
+
=end
|
254
|
+
def update_psd_properties(channels_count, compression_method, output_path,
|
255
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
256
|
+
str_uri = "#{@base_uri}/psd"
|
257
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:channelsCount=> channels_count,
|
258
|
+
:compressionMethod=> compression_method,
|
259
|
+
:outPath=> output_path})
|
260
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
261
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
262
|
+
puts signed_str_uri
|
263
|
+
response_stream = RestClient.get(signed_str_uri, {:content_type=>'application/json',
|
264
|
+
:accept=>'application/json'})
|
265
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
266
|
+
|
267
|
+
if valid_output.empty?
|
268
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}_updated.psd"
|
269
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
270
|
+
end
|
271
|
+
valid_output
|
272
|
+
end
|
273
|
+
|
274
|
+
=begin
|
275
|
+
Update PSD Image Properties without Storage
|
276
|
+
@param string input_file_path Path of the input file.
|
277
|
+
@param number channels_count Count of channels.
|
278
|
+
@param string compression_method Compression method.
|
279
|
+
=end
|
280
|
+
def update_psd_properties_local(input_file_path, channels_count, compression_method,
|
281
|
+
folder_name = '', storage_type = 'Aspose', storage_name = '')
|
282
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/imaging/psd"
|
283
|
+
str_uri = Aspose::Cloud::Common::Utils.build_uri(str_uri, {:channelsCount=> channels_count,
|
284
|
+
:compressionMethod=> compression_method})
|
285
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri, folder_name, storage_name, storage_type)
|
286
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
287
|
+
|
288
|
+
response_stream = RestClient.post(signed_str_uri, File.new(input_file_path, 'rb'),
|
289
|
+
{:content_type=>'application/json', :accept=>'application/json'})
|
290
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
291
|
+
|
292
|
+
if valid_output.empty?
|
293
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(input_file_path)}_updated.psd"
|
294
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
295
|
+
end
|
296
|
+
valid_output
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|