aspose_pdf_cloud 19.1.0 → 19.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,56 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2019 Aspose.PDF 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
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+ class StampIcon
27
+
28
+ DRAFT = "Draft".freeze
29
+ APPROVED = "Approved".freeze
30
+ EXPERIMENTAL = "Experimental".freeze
31
+ NOT_APPROVED = "NotApproved".freeze
32
+ AS_IS = "AsIs".freeze
33
+ EXPIRED = "Expired".freeze
34
+ NOT_FOR_PUBLIC_RELEASE = "NotForPublicRelease".freeze
35
+ CONFIDENTIAL = "Confidential".freeze
36
+ FINAL = "Final".freeze
37
+ SOLD = "Sold".freeze
38
+ DEPARTMENTAL = "Departmental".freeze
39
+ FOR_COMMENT = "ForComment".freeze
40
+ FOR_PUBLIC_RELEASE = "ForPublicRelease".freeze
41
+ TOP_SECRET = "TopSecret".freeze
42
+
43
+ # Builds the enum from string
44
+ # @param [String] The enum value in the form of the string
45
+ # @return [String] The enum value
46
+ def build_from_hash(value)
47
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
48
+ # consantValues = StampIcon.constants.select{|c| c.to_s == value}
49
+ constantValues = StampIcon.constants.select{ |const_name| StampIcon.const_get(const_name) == value}
50
+
51
+ raise "Invalid ENUM value #{value} for class #StampIcon" if constantValues.empty?
52
+ value
53
+ end
54
+ end
55
+
56
+ end
@@ -20,5 +20,5 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  module AsposePdfCloud
23
- VERSION = "19.1.0"
23
+ VERSION = "19.2.0"
24
24
  end
@@ -121,6 +121,293 @@ class PdfTests < Minitest::Test
121
121
  assert(response, 'Failed to delete annotation.')
122
122
  end
123
123
 
124
+ def test_put_annotations_flatten
125
+ file_name = 'PdfWithAnnotations.pdf'
126
+ upload_file(file_name)
127
+
128
+ opts = {
129
+ :endPage => 2,
130
+ :annotationTypes => [AnnotationType::STAMP],
131
+ :folder => @temp_folder
132
+ }
133
+
134
+ response = @pdf_api.put_annotations_flatten(file_name, opts)
135
+ assert(response, 'Failed to make annotations flatten.')
136
+ end
137
+
138
+
139
+ # Screen Annotations Tests
140
+
141
+ def test_get_document_screen_annotations
142
+ file_name = 'PdfWithScreenAnnotations.pdf'
143
+ upload_file(file_name)
144
+
145
+ opts = {
146
+ :folder => @temp_folder
147
+ }
148
+
149
+ response = @pdf_api.get_document_screen_annotations(file_name, opts)
150
+ assert(response, 'Failed to read document screen annotations.')
151
+ end
152
+
153
+ def test_get_page_screen_annotations
154
+ file_name = 'PdfWithScreenAnnotations.pdf'
155
+ upload_file(file_name)
156
+
157
+ page_number = 1
158
+ opts = {
159
+ :folder => @temp_folder
160
+ }
161
+
162
+ response = @pdf_api.get_page_screen_annotations(file_name, page_number, opts)
163
+ assert(response, 'Failed to read page screen annotations.')
164
+ end
165
+
166
+ def test_post_page_screen_annotations
167
+ file_name = 'PdfWithScreenAnnotations.pdf'
168
+ upload_file(file_name)
169
+
170
+ attachment_file = 'ScreenMovie.swf'
171
+ upload_file(attachment_file)
172
+
173
+ page_number = 1
174
+
175
+ opts = {
176
+ :folder => @temp_folder
177
+ }
178
+
179
+ annotation = ScreenAnnotation.new
180
+ annotation.name = 'Test Screen Annotation'
181
+ annotation.rect = Rectangle.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
182
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
183
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
184
+ annotation.z_index = 1
185
+ annotation.title = 'Title'
186
+ annotation.modified = '02/02/2018 12:00:00.000 AM'
187
+ annotation.file_path = @temp_folder + '/' + attachment_file
188
+
189
+ response = @pdf_api.post_page_screen_annotations(file_name, page_number, [annotation], opts)
190
+ assert(response, 'Failed to add screen annotations into page.')
191
+ end
192
+
193
+ def test_get_screen_annotation
194
+ file_name = 'PdfWithScreenAnnotations.pdf'
195
+ upload_file(file_name)
196
+
197
+ opts = {
198
+ :folder => @temp_folder
199
+ }
200
+
201
+ annotations_response = @pdf_api.get_document_screen_annotations(file_name, opts)
202
+ assert(annotations_response, 'Failed to read document screen annotations.')
203
+ annotation_id = annotations_response[0].annotations.list[0].id
204
+
205
+ response = @pdf_api.get_screen_annotation(file_name, annotation_id, opts)
206
+ assert(response, 'Failed to read page screen annotations.')
207
+ end
208
+
209
+ def test_put_screen_annotation
210
+ file_name = 'PdfWithScreenAnnotations.pdf'
211
+ upload_file(file_name)
212
+
213
+ attachment_file = 'ScreenMovie.swf'
214
+ upload_file(attachment_file)
215
+
216
+ opts = {
217
+ :folder => @temp_folder
218
+ }
219
+
220
+ annotation = ScreenAnnotation.new
221
+ annotation.name = 'Test Screen Annotation Updated'
222
+ annotation.rect = Rectangle.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
223
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
224
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
225
+ annotation.z_index = 1
226
+ annotation.title = 'Title'
227
+ annotation.modified = '03/04/2018 12:00:00.000 AM'
228
+ annotation.file_path = @temp_folder + '/' + attachment_file
229
+
230
+ annotations_response = @pdf_api.get_document_screen_annotations(file_name, opts)
231
+ assert(annotations_response, 'Failed to read document screen annotations.')
232
+ annotation_id = annotations_response[0].annotations.list[0].id
233
+
234
+ response = @pdf_api.put_screen_annotation(file_name, annotation_id, annotation, opts)
235
+ assert(response, 'Failed to replace screen annotation.')
236
+ end
237
+
238
+ =begin
239
+ def test_get_screen_annotation_data
240
+ file_name = 'PdfWithScreenAnnotations.pdf'
241
+ upload_file(file_name)
242
+
243
+ opts = {
244
+ :folder => @temp_folder
245
+ }
246
+
247
+ annotations_response = @pdf_api.get_document_screen_annotations(file_name, opts)
248
+ assert(annotations_response, 'Failed to read document screen annotations.')
249
+ annotation_id = annotations_response[0].annotations.list[0].id
250
+
251
+ response = @pdf_api.get_screen_annotation_data(file_name, annotation_id, opts)
252
+ assert(response, 'Failed to read page screen annotation data.')
253
+ end
254
+
255
+ def test_put_screen_annotation_data_extract
256
+ file_name = 'PdfWithScreenAnnotations.pdf'
257
+ upload_file(file_name)
258
+
259
+ opts = {
260
+ :folder => @temp_folder
261
+ }
262
+
263
+ annotations_response = @pdf_api.get_document_screen_annotations(file_name, opts)
264
+ assert(annotations_response, 'Failed to read document screen annotations.')
265
+ annotation_id = annotations_response[0].annotations.list[0].id
266
+
267
+ response = @pdf_api.put_screen_annotation_data_extract(file_name, annotation_id, opts)
268
+ assert(response, 'Failed to read page screen annotation data.')
269
+ end
270
+ =end
271
+
272
+
273
+ # Stamp Annotations Tests
274
+
275
+ def test_get_document_stamp_annotations
276
+ file_name = 'PdfWithAnnotations.pdf'
277
+ upload_file(file_name)
278
+
279
+ opts = {
280
+ :folder => @temp_folder
281
+ }
282
+
283
+ response = @pdf_api.get_document_stamp_annotations(file_name, opts)
284
+ assert(response, 'Failed to read document Stamp annotations.')
285
+ end
286
+
287
+ def test_get_page_stamp_annotations
288
+ file_name = 'PdfWithAnnotations.pdf'
289
+ upload_file(file_name)
290
+
291
+ page_number = 1
292
+ opts = {
293
+ :folder => @temp_folder
294
+ }
295
+
296
+ response = @pdf_api.get_page_stamp_annotations(file_name, page_number, opts)
297
+ assert(response, 'Failed to read page Stamp annotations.')
298
+ end
299
+
300
+ def test_post_page_stamp_annotations
301
+ file_name = 'PdfWithAnnotations.pdf'
302
+ upload_file(file_name)
303
+
304
+ attachment_file = '4pages.pdf'
305
+ upload_file(attachment_file)
306
+
307
+ page_number = 1
308
+
309
+ opts = {
310
+ :folder => @temp_folder
311
+ }
312
+
313
+ annotation = StampAnnotation.new
314
+ annotation.name = 'Test Stamp Annotation'
315
+ annotation.rect = Rectangle.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
316
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
317
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
318
+ annotation.rich_text = 'Rich text'
319
+ annotation.subject = 'Subj'
320
+ annotation.z_index = 1
321
+ annotation.title = 'Title'
322
+ annotation.modified = '02/02/2018 12:00:00.000 AM'
323
+ annotation.file_path = @temp_folder + '/' + attachment_file
324
+
325
+ response = @pdf_api.post_page_stamp_annotations(file_name, page_number, [annotation], opts)
326
+ assert(response, 'Failed to add Stamp annotations into page.')
327
+ end
328
+
329
+ def test_get_stamp_annotation
330
+ file_name = 'PdfWithAnnotations.pdf'
331
+ upload_file(file_name)
332
+
333
+ opts = {
334
+ :folder => @temp_folder
335
+ }
336
+
337
+ annotations_response = @pdf_api.get_document_stamp_annotations(file_name, opts)
338
+ assert(annotations_response, 'Failed to read document Stamp annotations.')
339
+ annotation_id = annotations_response[0].annotations.list[0].id
340
+
341
+ response = @pdf_api.get_stamp_annotation(file_name, annotation_id, opts)
342
+ assert(response, 'Failed to read page Stamp annotations.')
343
+ end
344
+
345
+ def test_put_stamp_annotation
346
+ file_name = 'PdfWithAnnotations.pdf'
347
+ upload_file(file_name)
348
+
349
+ attachment_file = '4pages.pdf'
350
+ upload_file(attachment_file)
351
+
352
+ opts = {
353
+ :folder => @temp_folder
354
+ }
355
+
356
+ annotation = StampAnnotation.new
357
+ annotation.name = 'Test Stamp Annotation Updated'
358
+ annotation.rect = Rectangle.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
359
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
360
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
361
+ annotation.z_index = 1
362
+ annotation.rich_text = 'Rich text'
363
+ annotation.subject = 'Subj'
364
+ annotation.title = 'Title'
365
+ annotation.modified = '03/04/2018 12:00:00.000 AM'
366
+ annotation.file_path = @temp_folder + '/' + attachment_file
367
+
368
+ annotations_response = @pdf_api.get_document_stamp_annotations(file_name, opts)
369
+ assert(annotations_response, 'Failed to read document Stamp annotations.')
370
+ annotation_id = annotations_response[0].annotations.list[0].id
371
+
372
+ response = @pdf_api.put_stamp_annotation(file_name, annotation_id, annotation, opts)
373
+ assert(response, 'Failed to replace Stamp annotation.')
374
+ end
375
+
376
+
377
+ def test_get_stamp_annotation_data
378
+ file_name = 'PdfWithAnnotations.pdf'
379
+ upload_file(file_name)
380
+
381
+ opts = {
382
+ :folder => @temp_folder
383
+ }
384
+
385
+ annotations_response = @pdf_api.get_document_stamp_annotations(file_name, opts)
386
+ assert(annotations_response, 'Failed to read document Stamp annotations.')
387
+ annotation_id = annotations_response[0].annotations.list[0].id
388
+
389
+ response = @pdf_api.get_stamp_annotation_data(file_name, annotation_id, opts)
390
+ assert(response, 'Failed to read page Stamp annotation data.')
391
+ end
392
+
393
+ def test_put_stamp_annotation_data_extract
394
+ file_name = 'PdfWithAnnotations.pdf'
395
+ upload_file(file_name)
396
+
397
+ out_file_path = 'stamp.dat'
398
+ opts = {
399
+ :folder => @temp_folder
400
+ }
401
+
402
+ annotations_response = @pdf_api.get_document_stamp_annotations(file_name, opts)
403
+ assert(annotations_response, 'Failed to read document Stamp annotations.')
404
+ annotation_id = annotations_response[0].annotations.list[0].id
405
+
406
+ response = @pdf_api.put_stamp_annotation_data_extract(file_name, annotation_id, out_file_path, opts)
407
+ assert(response, 'Failed to read page Stamp annotation data.')
408
+ end
409
+
410
+
124
411
  # PolyLine Annotations Tests
125
412
 
126
413
  def test_get_document_poly_line_annotations
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_pdf_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.1.0
4
+ version: 19.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aspose PDF Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-11 00:00:00.000000000 Z
11
+ date: 2019-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -210,6 +210,10 @@ files:
210
210
  - docs/RedactionAnnotations.md
211
211
  - docs/RedactionAnnotationsResponse.md
212
212
  - docs/Rotation.md
213
+ - docs/ScreenAnnotation.md
214
+ - docs/ScreenAnnotationResponse.md
215
+ - docs/ScreenAnnotations.md
216
+ - docs/ScreenAnnotationsResponse.md
213
217
  - docs/Segment.md
214
218
  - docs/ShapeType.md
215
219
  - docs/Signature.md
@@ -233,6 +237,11 @@ files:
233
237
  - docs/SquigglyAnnotations.md
234
238
  - docs/SquigglyAnnotationsResponse.md
235
239
  - docs/Stamp.md
240
+ - docs/StampAnnotation.md
241
+ - docs/StampAnnotationResponse.md
242
+ - docs/StampAnnotations.md
243
+ - docs/StampAnnotationsResponse.md
244
+ - docs/StampIcon.md
236
245
  - docs/StampType.md
237
246
  - docs/StorageExistResponse.md
238
247
  - docs/StrikeOutAnnotation.md
@@ -406,6 +415,10 @@ files:
406
415
  - lib/aspose_pdf_cloud/models/redaction_annotations.rb
407
416
  - lib/aspose_pdf_cloud/models/redaction_annotations_response.rb
408
417
  - lib/aspose_pdf_cloud/models/rotation.rb
418
+ - lib/aspose_pdf_cloud/models/screen_annotation.rb
419
+ - lib/aspose_pdf_cloud/models/screen_annotation_response.rb
420
+ - lib/aspose_pdf_cloud/models/screen_annotations.rb
421
+ - lib/aspose_pdf_cloud/models/screen_annotations_response.rb
409
422
  - lib/aspose_pdf_cloud/models/segment.rb
410
423
  - lib/aspose_pdf_cloud/models/shape_type.rb
411
424
  - lib/aspose_pdf_cloud/models/signature.rb
@@ -429,6 +442,11 @@ files:
429
442
  - lib/aspose_pdf_cloud/models/squiggly_annotations.rb
430
443
  - lib/aspose_pdf_cloud/models/squiggly_annotations_response.rb
431
444
  - lib/aspose_pdf_cloud/models/stamp.rb
445
+ - lib/aspose_pdf_cloud/models/stamp_annotation.rb
446
+ - lib/aspose_pdf_cloud/models/stamp_annotation_response.rb
447
+ - lib/aspose_pdf_cloud/models/stamp_annotations.rb
448
+ - lib/aspose_pdf_cloud/models/stamp_annotations_response.rb
449
+ - lib/aspose_pdf_cloud/models/stamp_icon.rb
432
450
  - lib/aspose_pdf_cloud/models/stamp_type.rb
433
451
  - lib/aspose_pdf_cloud/models/storage_exist_response.rb
434
452
  - lib/aspose_pdf_cloud/models/strike_out_annotation.rb
@@ -478,9 +496,11 @@ files:
478
496
  - test_data/PdfWithEmbeddedFiles.pdf
479
497
  - test_data/PdfWithImages2.pdf
480
498
  - test_data/PdfWithLinks.pdf
499
+ - test_data/PdfWithScreenAnnotations.pdf
481
500
  - test_data/PdfWithXfaForm.pdf
482
501
  - test_data/Penguins.emf
483
502
  - test_data/Penguins.jpg
503
+ - test_data/ScreenMovie.swf
484
504
  - test_data/Simple.svg
485
505
  - test_data/Simple.xps
486
506
  - test_data/TexExample.tex