aspose_pdf_cloud 18.5.0 → 18.6.0
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.
- checksums.yaml +4 -4
- data/lib/aspose_pdf_cloud.rb +4 -0
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +3094 -1679
- data/lib/aspose_pdf_cloud/models/image_src_type.rb +43 -0
- data/lib/aspose_pdf_cloud/models/image_template.rb +281 -0
- data/lib/aspose_pdf_cloud/models/image_templates_request.rb +230 -0
- data/lib/aspose_pdf_cloud/models/margin_info.rb +244 -0
- data/lib/aspose_pdf_cloud/version.rb +1 -1
- data/test/pdf_tests.rb +266 -0
- data/test_data/Typography.PS +29 -0
- metadata +7 -2
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
|
3
|
+
Copyright (c) 2018 Aspose.Pdf for Cloud
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
+
SOFTWARE.
|
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
|
20
|
+
=end
|
|
21
|
+
|
|
22
|
+
require 'date'
|
|
23
|
+
|
|
24
|
+
module AsposePdfCloud
|
|
25
|
+
|
|
26
|
+
class MarginInfo
|
|
27
|
+
attr_accessor :left
|
|
28
|
+
|
|
29
|
+
attr_accessor :right
|
|
30
|
+
|
|
31
|
+
attr_accessor :top
|
|
32
|
+
|
|
33
|
+
attr_accessor :bottom
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'left' => :'Left',
|
|
40
|
+
:'right' => :'Right',
|
|
41
|
+
:'top' => :'Top',
|
|
42
|
+
:'bottom' => :'Bottom'
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute type mapping.
|
|
47
|
+
def self.swagger_types
|
|
48
|
+
{
|
|
49
|
+
:'left' => :'Float',
|
|
50
|
+
:'right' => :'Float',
|
|
51
|
+
:'top' => :'Float',
|
|
52
|
+
:'bottom' => :'Float'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Initializes the object
|
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
58
|
+
def initialize(attributes = {})
|
|
59
|
+
return unless attributes.is_a?(Hash)
|
|
60
|
+
|
|
61
|
+
# convert string to symbol for hash key
|
|
62
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
63
|
+
|
|
64
|
+
if attributes.has_key?(:'Left')
|
|
65
|
+
self.left = attributes[:'Left']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.has_key?(:'Right')
|
|
69
|
+
self.right = attributes[:'Right']
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if attributes.has_key?(:'Top')
|
|
73
|
+
self.top = attributes[:'Top']
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if attributes.has_key?(:'Bottom')
|
|
77
|
+
self.bottom = attributes[:'Bottom']
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
83
|
+
# @return Array for valid properies with the reasons
|
|
84
|
+
def list_invalid_properties
|
|
85
|
+
invalid_properties = Array.new
|
|
86
|
+
if @left.nil?
|
|
87
|
+
invalid_properties.push("invalid value for 'left', left cannot be nil.")
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if @right.nil?
|
|
91
|
+
invalid_properties.push("invalid value for 'right', right cannot be nil.")
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if @top.nil?
|
|
95
|
+
invalid_properties.push("invalid value for 'top', top cannot be nil.")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if @bottom.nil?
|
|
99
|
+
invalid_properties.push("invalid value for 'bottom', bottom cannot be nil.")
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
return invalid_properties
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Check to see if the all the properties in the model are valid
|
|
106
|
+
# @return true if the model is valid
|
|
107
|
+
def valid?
|
|
108
|
+
return false if @left.nil?
|
|
109
|
+
return false if @right.nil?
|
|
110
|
+
return false if @top.nil?
|
|
111
|
+
return false if @bottom.nil?
|
|
112
|
+
return true
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Checks equality by comparing each attribute.
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def ==(o)
|
|
118
|
+
return true if self.equal?(o)
|
|
119
|
+
self.class == o.class &&
|
|
120
|
+
left == o.left &&
|
|
121
|
+
right == o.right &&
|
|
122
|
+
top == o.top &&
|
|
123
|
+
bottom == o.bottom
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# @see the `==` method
|
|
127
|
+
# @param [Object] Object to be compared
|
|
128
|
+
def eql?(o)
|
|
129
|
+
self == o
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Calculates hash code according to all attributes.
|
|
133
|
+
# @return [Fixnum] Hash code
|
|
134
|
+
def hash
|
|
135
|
+
[left, right, top, bottom].hash
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Builds the object from hash
|
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
140
|
+
# @return [Object] Returns the model itself
|
|
141
|
+
def build_from_hash(attributes)
|
|
142
|
+
return nil unless attributes.is_a?(Hash)
|
|
143
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
144
|
+
if type =~ /\AArray<(.*)>/i
|
|
145
|
+
# check to ensure the input is an array given that the the attribute
|
|
146
|
+
# is documented as an array but the input is not
|
|
147
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
148
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
149
|
+
end
|
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
151
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
152
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
self
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Deserializes the data based on type
|
|
159
|
+
# @param string type Data type
|
|
160
|
+
# @param string value Value to be deserialized
|
|
161
|
+
# @return [Object] Deserialized data
|
|
162
|
+
def _deserialize(type, value)
|
|
163
|
+
case type.to_sym
|
|
164
|
+
when :DateTime
|
|
165
|
+
DateTime.parse(value)
|
|
166
|
+
when :Date
|
|
167
|
+
Date.parse(value)
|
|
168
|
+
when :String
|
|
169
|
+
value.to_s
|
|
170
|
+
when :Integer
|
|
171
|
+
value.to_i
|
|
172
|
+
when :Float
|
|
173
|
+
value.to_f
|
|
174
|
+
when :BOOLEAN
|
|
175
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
176
|
+
true
|
|
177
|
+
else
|
|
178
|
+
false
|
|
179
|
+
end
|
|
180
|
+
when :Object
|
|
181
|
+
# generic object (usually a Hash), return directly
|
|
182
|
+
value
|
|
183
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
184
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
185
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
186
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
187
|
+
k_type = Regexp.last_match[:k_type]
|
|
188
|
+
v_type = Regexp.last_match[:v_type]
|
|
189
|
+
{}.tap do |hash|
|
|
190
|
+
value.each do |k, v|
|
|
191
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
else # model
|
|
195
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
|
196
|
+
temp_model.build_from_hash(value)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Returns the string representation of the object
|
|
201
|
+
# @return [String] String presentation of the object
|
|
202
|
+
def to_s
|
|
203
|
+
to_hash.to_s
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
|
208
|
+
def to_body
|
|
209
|
+
to_hash
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Returns the object in the form of hash
|
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
|
214
|
+
def to_hash
|
|
215
|
+
hash = {}
|
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
217
|
+
value = self.send(attr)
|
|
218
|
+
next if value.nil?
|
|
219
|
+
hash[param] = _to_hash(value)
|
|
220
|
+
end
|
|
221
|
+
hash
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Outputs non-array value in the form of hash
|
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
226
|
+
# @param [Object] value Any valid value
|
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
|
228
|
+
def _to_hash(value)
|
|
229
|
+
if value.is_a?(Array)
|
|
230
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
231
|
+
elsif value.is_a?(Hash)
|
|
232
|
+
{}.tap do |hash|
|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
234
|
+
end
|
|
235
|
+
elsif value.respond_to? :to_hash
|
|
236
|
+
value.to_hash
|
|
237
|
+
else
|
|
238
|
+
value
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
end
|
data/test/pdf_tests.rb
CHANGED
|
@@ -630,6 +630,62 @@ class PdfTests < Minitest::Test
|
|
|
630
630
|
assert(response, 'Failed to replace document image.')
|
|
631
631
|
end
|
|
632
632
|
|
|
633
|
+
def test_put_images_extract_as_jpeg
|
|
634
|
+
name = "PdfWithImages2.pdf"
|
|
635
|
+
upload_file(name)
|
|
636
|
+
page_number = 1
|
|
637
|
+
|
|
638
|
+
dest_folder = "extract_jpg"
|
|
639
|
+
opts = {
|
|
640
|
+
:dest_folder => @temp_folder + '/' + dest_folder,
|
|
641
|
+
:folder => @temp_folder
|
|
642
|
+
}
|
|
643
|
+
response = @pdf_api.put_images_extract_as_jpeg(name, page_number, opts)
|
|
644
|
+
assert(response, 'Failed to extract images as jpeg.')
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
def test_put_images_extract_as_tiff
|
|
648
|
+
name = "PdfWithImages2.pdf"
|
|
649
|
+
upload_file(name)
|
|
650
|
+
page_number = 1
|
|
651
|
+
|
|
652
|
+
dest_folder = "extract_tiff"
|
|
653
|
+
opts = {
|
|
654
|
+
:dest_folder => @temp_folder + '/' + dest_folder,
|
|
655
|
+
:folder => @temp_folder
|
|
656
|
+
}
|
|
657
|
+
response = @pdf_api.put_images_extract_as_tiff(name, page_number, opts)
|
|
658
|
+
assert(response, 'Failed to extract images as tiff.')
|
|
659
|
+
end
|
|
660
|
+
|
|
661
|
+
def test_put_images_extract_as_gif
|
|
662
|
+
name = "PdfWithImages2.pdf"
|
|
663
|
+
upload_file(name)
|
|
664
|
+
page_number = 1
|
|
665
|
+
|
|
666
|
+
dest_folder = "extract_gif"
|
|
667
|
+
opts = {
|
|
668
|
+
:dest_folder => @temp_folder + '/' + dest_folder,
|
|
669
|
+
:folder => @temp_folder
|
|
670
|
+
}
|
|
671
|
+
response = @pdf_api.put_images_extract_as_gif(name, page_number, opts)
|
|
672
|
+
assert(response, 'Failed to extract images as gif.')
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
def test_put_images_extract_as_png
|
|
676
|
+
name = "PdfWithImages2.pdf"
|
|
677
|
+
upload_file(name)
|
|
678
|
+
page_number = 1
|
|
679
|
+
|
|
680
|
+
dest_folder = "extract_png"
|
|
681
|
+
opts = {
|
|
682
|
+
:dest_folder => @temp_folder + '/' + dest_folder,
|
|
683
|
+
:folder => @temp_folder
|
|
684
|
+
}
|
|
685
|
+
response = @pdf_api.put_images_extract_as_png(name, page_number, opts)
|
|
686
|
+
assert(response, 'Failed to extract images as png.')
|
|
687
|
+
end
|
|
688
|
+
|
|
633
689
|
# Links Tests
|
|
634
690
|
|
|
635
691
|
def test_get_page_link_annotation_by_index
|
|
@@ -2118,5 +2174,215 @@ class PdfTests < Minitest::Test
|
|
|
2118
2174
|
response = @pdf_api.put_xml_in_storage_to_pdf(result_name, src_path, opts)
|
|
2119
2175
|
assert(response, 'Failed to convert xml to pdf.')
|
|
2120
2176
|
end
|
|
2177
|
+
|
|
2178
|
+
def test_get_ps_in_storage_to_pdf
|
|
2179
|
+
file_name = 'Typography.PS'
|
|
2180
|
+
upload_file(file_name)
|
|
2181
|
+
|
|
2182
|
+
src_path = @temp_folder + '/' + file_name
|
|
2183
|
+
response = @pdf_api.get_ps_in_storage_to_pdf(src_path)
|
|
2184
|
+
assert(response, 'Failed to convert ps to pdf.')
|
|
2185
|
+
end
|
|
2186
|
+
|
|
2187
|
+
def test_put_ps_in_storage_to_pdf
|
|
2188
|
+
file_name = 'Typography.PS'
|
|
2189
|
+
upload_file(file_name)
|
|
2190
|
+
result_name = 'fromPs.pdf'
|
|
2191
|
+
|
|
2192
|
+
src_path = @temp_folder + '/' + file_name
|
|
2193
|
+
opts = {
|
|
2194
|
+
:dst_folder => @temp_folder
|
|
2195
|
+
}
|
|
2196
|
+
response = @pdf_api.put_ps_in_storage_to_pdf(result_name, src_path, opts)
|
|
2197
|
+
assert(response, 'Failed to convert ps to pdf.')
|
|
2198
|
+
end
|
|
2199
|
+
|
|
2200
|
+
def test_put_image_in_storage_to_pdf
|
|
2201
|
+
data_file_1 = "33539.jpg"
|
|
2202
|
+
upload_file(data_file_1)
|
|
2203
|
+
|
|
2204
|
+
data_file_2 = "44781.jpg"
|
|
2205
|
+
upload_file(data_file_2)
|
|
2206
|
+
|
|
2207
|
+
result_name = "result.pdf";
|
|
2208
|
+
|
|
2209
|
+
image_template_1 = ImageTemplate.new
|
|
2210
|
+
image_template_1.image_path = @temp_folder + '/' + data_file_1
|
|
2211
|
+
image_template_1.image_src_type = ImageSrcType::COMMON
|
|
2212
|
+
|
|
2213
|
+
image_template_2 = ImageTemplate.new
|
|
2214
|
+
image_template_2.image_path = @temp_folder + '/' + data_file_2
|
|
2215
|
+
image_template_2.image_src_type = ImageSrcType::COMMON
|
|
2216
|
+
|
|
2217
|
+
image_templates_request = ImageTemplatesRequest.new
|
|
2218
|
+
image_templates_request.is_ocr = true
|
|
2219
|
+
image_templates_request.ocr_langs = "eng"
|
|
2220
|
+
image_templates_request.images_list = [image_template_1, image_template_2]
|
|
2221
|
+
|
|
2222
|
+
opts = {
|
|
2223
|
+
:dst_folder => @temp_folder
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
response = @pdf_api.put_image_in_storage_to_pdf(result_name, image_templates_request, opts)
|
|
2227
|
+
assert(response, 'Failed to convert images to pdf.')
|
|
2228
|
+
end
|
|
2229
|
+
|
|
2230
|
+
# Page Convert To Images Tests
|
|
2231
|
+
|
|
2232
|
+
def test_get_page_convert_to_tiff
|
|
2233
|
+
name = "4pages.pdf"
|
|
2234
|
+
upload_file(name)
|
|
2235
|
+
|
|
2236
|
+
page_number = 2
|
|
2237
|
+
opts = {
|
|
2238
|
+
:folder => @temp_folder
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
response = @pdf_api.get_page_convert_to_tiff(name, page_number, opts)
|
|
2242
|
+
assert(response, 'Failed to convert page as tiff.')
|
|
2243
|
+
end
|
|
2244
|
+
|
|
2245
|
+
def test_put_page_convert_to_tiff
|
|
2246
|
+
name = "4pages.pdf"
|
|
2247
|
+
upload_file(name)
|
|
2248
|
+
result_file = "page.tiff"
|
|
2249
|
+
out_path = @temp_folder + '/' + result_file
|
|
2250
|
+
page_number = 2
|
|
2251
|
+
opts = {
|
|
2252
|
+
:folder => @temp_folder
|
|
2253
|
+
}
|
|
2254
|
+
response = @pdf_api.put_page_convert_to_tiff(name, page_number, out_path, opts)
|
|
2255
|
+
assert(response, 'Failed to convert page as tiff.')
|
|
2256
|
+
end
|
|
2257
|
+
|
|
2258
|
+
def test_get_page_convert_to_jpeg
|
|
2259
|
+
name = "4pages.pdf"
|
|
2260
|
+
upload_file(name)
|
|
2261
|
+
|
|
2262
|
+
page_number = 2
|
|
2263
|
+
opts = {
|
|
2264
|
+
:folder => @temp_folder
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
response = @pdf_api.get_page_convert_to_jpeg(name, page_number, opts)
|
|
2268
|
+
assert(response, 'Failed to convert page as jpeg.')
|
|
2269
|
+
end
|
|
2270
|
+
|
|
2271
|
+
def test_put_page_convert_to_jpeg
|
|
2272
|
+
name = "4pages.pdf"
|
|
2273
|
+
upload_file(name)
|
|
2274
|
+
result_file = "page.jpeg"
|
|
2275
|
+
out_path = @temp_folder + '/' + result_file
|
|
2276
|
+
page_number = 2
|
|
2277
|
+
opts = {
|
|
2278
|
+
:folder => @temp_folder
|
|
2279
|
+
}
|
|
2280
|
+
response = @pdf_api.put_page_convert_to_jpeg(name, page_number, out_path, opts)
|
|
2281
|
+
assert(response, 'Failed to convert page as jpeg.')
|
|
2282
|
+
end
|
|
2283
|
+
|
|
2284
|
+
def test_get_page_convert_to_png
|
|
2285
|
+
name = "4pages.pdf"
|
|
2286
|
+
upload_file(name)
|
|
2287
|
+
|
|
2288
|
+
page_number = 2
|
|
2289
|
+
opts = {
|
|
2290
|
+
:folder => @temp_folder
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
response = @pdf_api.get_page_convert_to_png(name, page_number, opts)
|
|
2294
|
+
assert(response, 'Failed to convert page as png.')
|
|
2295
|
+
end
|
|
2296
|
+
|
|
2297
|
+
def test_put_page_convert_to_png
|
|
2298
|
+
name = "4pages.pdf"
|
|
2299
|
+
upload_file(name)
|
|
2300
|
+
result_file = "page.png"
|
|
2301
|
+
out_path = @temp_folder + '/' + result_file
|
|
2302
|
+
page_number = 2
|
|
2303
|
+
opts = {
|
|
2304
|
+
:folder => @temp_folder
|
|
2305
|
+
}
|
|
2306
|
+
response = @pdf_api.put_page_convert_to_png(name, page_number, out_path, opts)
|
|
2307
|
+
assert(response, 'Failed to convert page as png.')
|
|
2308
|
+
end
|
|
2309
|
+
|
|
2310
|
+
def test_get_page_convert_to_emf
|
|
2311
|
+
name = "4pages.pdf"
|
|
2312
|
+
upload_file(name)
|
|
2313
|
+
|
|
2314
|
+
page_number = 2
|
|
2315
|
+
opts = {
|
|
2316
|
+
:folder => @temp_folder
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
response = @pdf_api.get_page_convert_to_emf(name, page_number, opts)
|
|
2320
|
+
assert(response, 'Failed to convert page as emf.')
|
|
2321
|
+
end
|
|
2322
|
+
|
|
2323
|
+
def test_put_page_convert_to_emf
|
|
2324
|
+
name = "4pages.pdf"
|
|
2325
|
+
upload_file(name)
|
|
2326
|
+
result_file = "page.emf"
|
|
2327
|
+
out_path = @temp_folder + '/' + result_file
|
|
2328
|
+
page_number = 2
|
|
2329
|
+
opts = {
|
|
2330
|
+
:folder => @temp_folder
|
|
2331
|
+
}
|
|
2332
|
+
response = @pdf_api.put_page_convert_to_emf(name, page_number, out_path, opts)
|
|
2333
|
+
assert(response, 'Failed to convert page as emf.')
|
|
2334
|
+
end
|
|
2335
|
+
|
|
2336
|
+
def test_get_page_convert_to_bmp
|
|
2337
|
+
name = "4pages.pdf"
|
|
2338
|
+
upload_file(name)
|
|
2339
|
+
|
|
2340
|
+
page_number = 2
|
|
2341
|
+
opts = {
|
|
2342
|
+
:folder => @temp_folder
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
response = @pdf_api.get_page_convert_to_bmp(name, page_number, opts)
|
|
2346
|
+
assert(response, 'Failed to convert page as bmp.')
|
|
2347
|
+
end
|
|
2348
|
+
|
|
2349
|
+
def test_put_page_convert_to_bmp
|
|
2350
|
+
name = "4pages.pdf"
|
|
2351
|
+
upload_file(name)
|
|
2352
|
+
result_file = "page.bmp"
|
|
2353
|
+
out_path = @temp_folder + '/' + result_file
|
|
2354
|
+
page_number = 2
|
|
2355
|
+
opts = {
|
|
2356
|
+
:folder => @temp_folder
|
|
2357
|
+
}
|
|
2358
|
+
response = @pdf_api.put_page_convert_to_bmp(name, page_number, out_path, opts)
|
|
2359
|
+
assert(response, 'Failed to convert page as bmp.')
|
|
2360
|
+
end
|
|
2361
|
+
|
|
2362
|
+
def test_get_page_convert_to_gif
|
|
2363
|
+
name = "4pages.pdf"
|
|
2364
|
+
upload_file(name)
|
|
2365
|
+
|
|
2366
|
+
page_number = 2
|
|
2367
|
+
opts = {
|
|
2368
|
+
:folder => @temp_folder
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
response = @pdf_api.get_page_convert_to_gif(name, page_number, opts)
|
|
2372
|
+
assert(response, 'Failed to convert page as gif.')
|
|
2373
|
+
end
|
|
2374
|
+
|
|
2375
|
+
def test_put_page_convert_to_gif
|
|
2376
|
+
name = "4pages.pdf"
|
|
2377
|
+
upload_file(name)
|
|
2378
|
+
result_file = "page.gif"
|
|
2379
|
+
out_path = @temp_folder + '/' + result_file
|
|
2380
|
+
page_number = 2
|
|
2381
|
+
opts = {
|
|
2382
|
+
:folder => @temp_folder
|
|
2383
|
+
}
|
|
2384
|
+
response = @pdf_api.put_page_convert_to_gif(name, page_number, out_path, opts)
|
|
2385
|
+
assert(response, 'Failed to convert page as gif.')
|
|
2386
|
+
end
|
|
2121
2387
|
end
|
|
2122
2388
|
|