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/Pdf/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 Pdf
|
data/lib/Pdf/text_editor.rb
CHANGED
@@ -1,22 +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
|
-
# To change this template, choose Tools | Templates
|
19
|
-
# and open the template in the editor.
|
20
1
|
module Aspose
|
21
2
|
module Cloud
|
22
3
|
module Pdf
|
@@ -81,6 +62,23 @@ module Aspose
|
|
81
62
|
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['TextFormat']
|
82
63
|
end
|
83
64
|
|
65
|
+
=begin
|
66
|
+
Get Text Format of a Particular Segment
|
67
|
+
@param number page_number
|
68
|
+
@param number fragment_number
|
69
|
+
@param number segment_number
|
70
|
+
=end
|
71
|
+
def get_segment_text_format(page_number, fragment_number, segment_number, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
72
|
+
raise 'page_number not specified.' if page_number.nil?
|
73
|
+
raise 'fragment_number not specified.' if fragment_number.nil?
|
74
|
+
raise 'segment_number not specified.' if segment_number.nil?
|
75
|
+
|
76
|
+
str_uri = "#{@base_uri}/pages/#{page_number}/fragments/#{fragment_number}/segments/#{segment_number}/textformat"
|
77
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
78
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
79
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['TextFormat']
|
80
|
+
end
|
81
|
+
|
84
82
|
=begin
|
85
83
|
Replaces all instances of old text with new text in a PDF file or a particular page
|
86
84
|
@param string old_text
|
@@ -98,7 +96,24 @@ module Aspose
|
|
98
96
|
response_stream = RestClient.post(signed_str_uri,json_data,{ :content_type => 'application/json', :accept => 'application/json' })
|
99
97
|
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
100
98
|
valid_output.empty? ? true : valid_output
|
101
|
-
end
|
99
|
+
end
|
100
|
+
|
101
|
+
=begin
|
102
|
+
Replaces multiple instances of old text with new text in a PDF file or a particular page
|
103
|
+
@param string str_xml Data in XML format.
|
104
|
+
@param number page_number Number of the page.
|
105
|
+
=end
|
106
|
+
def replace_multiple_text(str_xml, page_number = 0, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
107
|
+
raise 'str_xml not specified.' if str_xml.empty?
|
108
|
+
|
109
|
+
str_uri = page_number > 0 ? "#{@base_uri}/pages/#{page_number}/replaceTextList" : "#{@base_uri}/replaceTextList"
|
110
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
111
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
112
|
+
|
113
|
+
response = Aspose::Cloud::Common::Utils.process_command(signed_str_uri,'POST','XML',str_xml)
|
114
|
+
json = JSON.parse(response)
|
115
|
+
json['Status'] == 'OK' ? true : false
|
116
|
+
end
|
102
117
|
|
103
118
|
=begin
|
104
119
|
Gets count of the segments in a fragment
|
data/lib/Slides/converter.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 Slides
|
@@ -62,7 +45,7 @@ module Aspose
|
|
62
45
|
|
63
46
|
str_uri = "#{@base_uri}/slides/#{slide_number}?format=#{save_format}"
|
64
47
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
65
|
-
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
48
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
66
49
|
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
67
50
|
|
68
51
|
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
@@ -73,6 +56,53 @@ module Aspose
|
|
73
56
|
end
|
74
57
|
valid_output
|
75
58
|
end
|
59
|
+
|
60
|
+
=begin
|
61
|
+
convert a document to other formats without using storage
|
62
|
+
=end
|
63
|
+
def convert_local_file(input_file_path, output_filename, save_format)
|
64
|
+
raise 'input_file_path not specified.' if input_file_path.empty?
|
65
|
+
raise 'output_filename not specified.' if output_filename.empty?
|
66
|
+
raise 'save_format not specified.' if save_format.empty?
|
67
|
+
|
68
|
+
str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/slides/convert?format=#{save_format}"
|
69
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
70
|
+
response_stream = Aspose::Cloud::Common::Utils.upload_file_binary(input_file_path, signed_str_uri)
|
71
|
+
|
72
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
73
|
+
|
74
|
+
if valid_output.empty?
|
75
|
+
save_format = 'zip' if save_format.eql?('html')
|
76
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}.#{save_format}"
|
77
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
78
|
+
end
|
79
|
+
valid_output
|
80
|
+
end
|
81
|
+
|
82
|
+
=begin
|
83
|
+
Convert PowerPoint Documents to other File Formats with Additional Settings
|
84
|
+
=end
|
85
|
+
def convert_with_additional_settings(save_format = 'pdf', text_compression = '', embed_full_fonts = '', compliance ='', jpeg_quality = '', save_metafiles_as_png = '', pdf_password = '', embed_true_type_fonts_for_ascii = '', folder_name = '', storage_type = 'Aspose', storage_name = '')
|
86
|
+
str_uri = "#{@base_uri}?format=#{save_format}"
|
87
|
+
str_uri += "&TextCompression=#{text_compression}" unless text_compression.empty?
|
88
|
+
str_uri += "&EmbedFullFonts=#{embed_full_fonts}" unless embed_full_fonts
|
89
|
+
str_uri += "&Compliance=#{compliance}" unless compliance.empty?
|
90
|
+
str_uri += "&JpegQuality=#{jpeg_quality}" unless jpeg_quality.nil?
|
91
|
+
str_uri += "&SaveMetafilesAsPng=#{save_metafiles_as_png}" unless save_metafiles_as_png
|
92
|
+
str_uri += "&PdfPassword=#{pdf_password}" unless pdf_password.empty?
|
93
|
+
str_uri += "&EmbedTrueTypeFontsForASCII=#{embed_true_type_fonts_for_ascii}" unless embed_true_type_fonts_for_ascii
|
94
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
95
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
96
|
+
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
97
|
+
|
98
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
99
|
+
|
100
|
+
if valid_output.empty?
|
101
|
+
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(@filename)}.#{save_format}"
|
102
|
+
Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)
|
103
|
+
end
|
104
|
+
valid_output
|
105
|
+
end
|
76
106
|
end
|
77
107
|
end
|
78
108
|
end
|
data/lib/Slides/document.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 Slides
|
@@ -24,6 +7,120 @@ module Aspose
|
|
24
7
|
raise 'filename not specified.' if filename.empty?
|
25
8
|
@base_uri = Aspose::Cloud::Common::Product.product_uri + '/slides/' + @filename
|
26
9
|
end
|
10
|
+
=begin
|
11
|
+
Add a New Slide in a PowerPoint Presentation
|
12
|
+
=end
|
13
|
+
def add_slide(position, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
14
|
+
raise 'position not specified.' if position.nil?
|
15
|
+
|
16
|
+
str_uri = "#{@base_uri}/slides?Position=#{position}"
|
17
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
18
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
19
|
+
|
20
|
+
response = RestClient.post(signed_str_uri, '', {:accept=>'application/json'})
|
21
|
+
json = JSON.parse(response)
|
22
|
+
json['Code'] == 200 ? json['Slides'] : nil
|
23
|
+
end
|
24
|
+
|
25
|
+
=begin
|
26
|
+
Create Empty PowerPoint Presentation
|
27
|
+
=end
|
28
|
+
def create_empty_presentation(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
29
|
+
str_uri = "#{@base_uri}"
|
30
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
31
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
32
|
+
|
33
|
+
response = RestClient.put(signed_str_uri, '', {:accept=>'application/json'})
|
34
|
+
json = JSON.parse(response)
|
35
|
+
json['Code'] == 200 ? json['Document'] : nil
|
36
|
+
end
|
37
|
+
|
38
|
+
=begin
|
39
|
+
Copy Slides in a PowerPoint Presentation
|
40
|
+
=end
|
41
|
+
def clone_slide(slide_number, position, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
42
|
+
raise 'slide_number not specified.' if slide_number <= 0
|
43
|
+
raise 'position not specified.' if position.nil?
|
44
|
+
|
45
|
+
str_uri = "#{@base_uri}/slides?SlideToClone=#{slide_number}&Position=#{position}"
|
46
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
47
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
48
|
+
|
49
|
+
response = RestClient.post(signed_str_uri, '', {:accept=>'application/json'})
|
50
|
+
json = JSON.parse(response)
|
51
|
+
json['Code'] == 200 ? json['Slides'] : nil
|
52
|
+
end
|
53
|
+
|
54
|
+
=begin
|
55
|
+
Change Position of Slides in a PowerPoint Presentation
|
56
|
+
=end
|
57
|
+
def change_slide_position(old_position, new_position, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
58
|
+
raise 'old_position not specified.' if old_position.nil?
|
59
|
+
raise 'new_position not specified.' if new_position.nil?
|
60
|
+
|
61
|
+
str_uri = "#{@base_uri}/slides?OldPosition=#{old_position}&NewPosition=#{new_position}"
|
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 = RestClient.post(signed_str_uri, '', {:accept=>'application/json'})
|
66
|
+
json = JSON.parse(response)
|
67
|
+
json['Code'] == 200 ? json['Slides'] : nil
|
68
|
+
end
|
69
|
+
|
70
|
+
=begin
|
71
|
+
Split PowerPoint Presentations
|
72
|
+
=end
|
73
|
+
def split_presentation(from = '', to = '', destination = '', format = '', folder_name = '', storage_type = 'Aspose', storage_name = '')
|
74
|
+
str_uri = "#{@base_uri}/split?"
|
75
|
+
str_uri = "#{str_uri}&from=#{from}" unless from.empty?
|
76
|
+
str_uri = "#{str_uri}&to=#{to}" unless to.empty?
|
77
|
+
str_uri = "#{str_uri}&destFolder=#{destination}" unless destination.empty?
|
78
|
+
str_uri = "#{str_uri}&format=#{format}" unless format.empty?
|
79
|
+
str_uri = str_uri[0...-1]
|
80
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
81
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
82
|
+
|
83
|
+
response = RestClient.post(signed_str_uri, '', {:accept=>'application/json'})
|
84
|
+
json = JSON.parse(response)
|
85
|
+
if json['Code'] == 200
|
86
|
+
json['SplitResult']['Slides'].each { |split_page|
|
87
|
+
split_filename = File.basename(split_page['Href'])
|
88
|
+
Aspose::Cloud::Common::Utils.download_file(split_filename,split_filename,folder_name,storage_name,storage_type)
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
=begin
|
94
|
+
Merge PowerPoint Presentations
|
95
|
+
@param xml presentation_list
|
96
|
+
=end
|
97
|
+
def merge_presentations(presentation_list, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
98
|
+
raise 'presentation_list not specified.' if presentation_list.empty?
|
99
|
+
|
100
|
+
str_uri = "#{@base_uri}/merge"
|
101
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
102
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
103
|
+
|
104
|
+
response = RestClient.post(signed_str_uri, presentation_list, {:accept=>'application/json'})
|
105
|
+
json = JSON.parse(response)
|
106
|
+
json['Code'] == 200 ? json['Document'] : nil
|
107
|
+
end
|
108
|
+
|
109
|
+
=begin
|
110
|
+
Merge Selected Slides of PowerPoint Presentations
|
111
|
+
@param xml presentation_list
|
112
|
+
=end
|
113
|
+
def merge_selected_slides(presentation_list, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
114
|
+
raise 'presentation_list not specified.' if presentation_list.empty?
|
115
|
+
|
116
|
+
str_uri = "#{@base_uri}/merge"
|
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 = RestClient.put(signed_str_uri, presentation_list, {:accept=>'application/json'})
|
121
|
+
json = JSON.parse(response)
|
122
|
+
json['Code'] == 200 ? json['Document'] : nil
|
123
|
+
end
|
27
124
|
|
28
125
|
=begin
|
29
126
|
Finds the slide count of the specified PowerPoint document
|
@@ -45,7 +142,10 @@ module Aspose
|
|
45
142
|
raise 'old_text not specified.' if old_text.empty?
|
46
143
|
raise 'new_text not specified.' if new_text.empty?
|
47
144
|
|
48
|
-
str_uri = "#{@base_uri}#{ slide_number > 0 ? '/slides/' + slide_number : '' }/replaceText"
|
145
|
+
#str_uri = "#{@base_uri}#{ slide_number > 0 ? '/slides/' + slide_number : '' }/replaceText"
|
146
|
+
str_uri = "#{@base_uri}"
|
147
|
+
str_uri += "/slides/#{slide_number}" unless slide_number <= 0
|
148
|
+
str_uri += "/replaceText"
|
49
149
|
qry = Hash.new
|
50
150
|
qry[:oldValue] = old_text
|
51
151
|
qry[:newValue] = new_text
|
@@ -63,8 +163,10 @@ module Aspose
|
|
63
163
|
@param number slide_number
|
64
164
|
@param boolean with_empty
|
65
165
|
=end
|
66
|
-
def get_all_text_items(slide_number=0, with_empty=false, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
67
|
-
str_uri = "#{@base_uri}
|
166
|
+
def get_all_text_items(slide_number=0, with_empty=false, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
167
|
+
str_uri = "#{@base_uri}"
|
168
|
+
str_uri += "/slides/#{slide_number}" unless slide_number <= 0
|
169
|
+
str_uri += "/textItems?withEmpty=#{with_empty}"
|
68
170
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
69
171
|
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
70
172
|
|
@@ -83,28 +185,60 @@ module Aspose
|
|
83
185
|
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
84
186
|
valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
|
85
187
|
end
|
86
|
-
|
188
|
+
|
87
189
|
=begin
|
88
|
-
|
190
|
+
Delete a Slide from a PowerPoint Presentation
|
89
191
|
=end
|
90
|
-
def
|
91
|
-
|
192
|
+
def delete_slide(slide_number, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
193
|
+
raise 'slide_number not specified.' if slide_number <= 0
|
194
|
+
|
195
|
+
str_uri = "#{@base_uri}/slides/#{slide_number}"
|
92
196
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
93
197
|
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
94
|
-
|
198
|
+
|
199
|
+
response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json'})
|
200
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
201
|
+
valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
|
95
202
|
end
|
96
203
|
|
97
204
|
=begin
|
98
|
-
|
99
|
-
@param string property_name
|
205
|
+
Delete Background of a PowerPoint Slide
|
100
206
|
=end
|
101
|
-
def
|
102
|
-
raise '
|
207
|
+
def delete_background(slide_number, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
208
|
+
raise 'slide_number not specified.' if slide_number <= 0
|
103
209
|
|
104
|
-
str_uri = "#{@base_uri}/
|
210
|
+
str_uri = "#{@base_uri}/slides/#{slide_number}/background"
|
211
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
212
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
213
|
+
|
214
|
+
response_stream = RestClient.delete(signed_str_uri, {:accept=>'application/json'})
|
215
|
+
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
216
|
+
valid_output.empty? ? Aspose::Cloud::Common::Utils.download_file(@filename,@filename,folder_name,storage_name,storage_type) : valid_output
|
217
|
+
end
|
218
|
+
|
219
|
+
=begin
|
220
|
+
Get Background of a PowerPoint Slide
|
221
|
+
=end
|
222
|
+
def get_background(slide_number, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
223
|
+
raise 'slide_number not specified.' if slide_number <= 0
|
224
|
+
|
225
|
+
str_uri = "#{@base_uri}/slides/#{slide_number}/background"
|
226
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
227
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
228
|
+
|
229
|
+
response = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
230
|
+
json = JSON.parse(response)
|
231
|
+
json['Code'] == 200 ? json['Background'] : nil
|
232
|
+
end
|
233
|
+
|
234
|
+
=begin
|
235
|
+
Get Document's properties
|
236
|
+
=end
|
237
|
+
def get_properties(folder_name = '', storage_type = 'Aspose', storage_name = '')
|
238
|
+
str_uri = "#{@base_uri}/documentProperties"
|
105
239
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
106
240
|
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
107
|
-
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['
|
241
|
+
JSON.parse(RestClient.get(signed_str_uri, {:accept=>'application/json'}))['DocumentProperties']['List']
|
108
242
|
end
|
109
243
|
|
110
244
|
=begin
|
@@ -147,28 +281,13 @@ module Aspose
|
|
147
281
|
JSON.parse(RestClient.delete(signed_str_uri, {:accept=>'application/json'}))['Code'] == 200 ? true : false
|
148
282
|
end
|
149
283
|
|
150
|
-
=begin
|
151
|
-
Add custom document properties
|
152
|
-
@param hash property_list
|
153
|
-
=end
|
154
|
-
def add_custom_property(property_list, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
155
|
-
raise 'property_list not specified.' if property_list.empty?
|
156
|
-
|
157
|
-
json_data = property_list.to_json
|
158
|
-
|
159
|
-
str_uri = "#{@base_uri}/documentProperties"
|
160
|
-
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
161
|
-
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
162
|
-
JSON.parse(RestClient.put(signed_str_uri, json_data, {:content_type=>:json, :accept=>'application/json'}))
|
163
|
-
end
|
164
|
-
|
165
284
|
=begin
|
166
285
|
saves the document into various formats
|
167
286
|
@param string outputFilename
|
168
287
|
@param string outputFormat
|
169
288
|
=end
|
170
289
|
|
171
|
-
def save_as(output_filename
|
290
|
+
def save_as(output_filename, output_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
172
291
|
raise 'output_filename not specified.' if output_filename.empty?
|
173
292
|
raise 'output_format not specified.' if output_format.empty?
|
174
293
|
|
@@ -184,24 +303,40 @@ module Aspose
|
|
184
303
|
|
185
304
|
=begin
|
186
305
|
saves the document into various formats
|
187
|
-
@param
|
306
|
+
@param number slide_number
|
188
307
|
@param string outputFilename
|
189
308
|
@param string outputFormat
|
190
309
|
=end
|
191
|
-
def save_slide_as(slide_number, output_filename
|
192
|
-
raise 'slide_number not specified.' if slide_number
|
310
|
+
def save_slide_as(slide_number, output_filename, output_format, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
311
|
+
raise 'slide_number not specified.' if slide_number <= 0
|
193
312
|
raise 'output_filename not specified.' if output_filename.empty?
|
194
313
|
raise 'output_format not specified.' if output_format.empty?
|
195
314
|
|
196
315
|
str_uri = "#{@base_uri}/slides/#{slide_number}?format=#{output_format}"
|
197
316
|
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
198
|
-
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
317
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
199
318
|
|
200
319
|
response_stream = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
201
320
|
valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)
|
202
321
|
output_path = "#{Aspose::Cloud::Common::AsposeApp.output_location}#{Aspose::Cloud::Common::Utils.get_filename(output_filename)}_#{slide_number}.#{output_format}"
|
203
322
|
valid_output.empty? ? Aspose::Cloud::Common::Utils.save_file(response_stream,output_path) : valid_output
|
204
323
|
end
|
324
|
+
|
325
|
+
=begin
|
326
|
+
Get Aspect Ratio of a PowerPoint Slide
|
327
|
+
@param number slide_number
|
328
|
+
=end
|
329
|
+
def aspect_ratio(slide_number, folder_name = '', storage_type = 'Aspose', storage_name = '')
|
330
|
+
raise 'slide_number not specified.' if slide_number <= 0
|
331
|
+
|
332
|
+
str_uri = "#{@base_uri}/slides/#{slide_number}"
|
333
|
+
str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,folder_name,storage_name,storage_type)
|
334
|
+
signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
|
335
|
+
|
336
|
+
response = RestClient.get(signed_str_uri, {:accept=>'application/json'})
|
337
|
+
json = JSON.parse(response)
|
338
|
+
json['Slide']['Width']/json['Slide']['Height']
|
339
|
+
end
|
205
340
|
end
|
206
341
|
end
|
207
342
|
end
|