@@ -319,6 +319,140 @@ class FieldsTests: AsposePdfCloudTests {
319
319
self . waitForExpectations ( timeout: testTimeout, handler: nil )
320
320
}
321
321
322
+ func testPostSignatureField( ) {
323
+
324
+ let name = " 4pages.pdf "
325
+ let signatureName = " 33226.p12 "
326
+
327
+ let expectation = self . expectation ( description: " testPostSignatureField " )
328
+
329
+ let signature = Signature (
330
+ signaturePath: " \( self . tempFolder) / \( signatureName) " ,
331
+ signatureType: SignatureType . pkcs7,
332
+ password: " sIikZSmz " ,
333
+ appearance: nil ,
334
+ reason: nil ,
335
+ contact: " test@mail.ru " ,
336
+ location: " Ukraine " ,
337
+ visible: true ,
338
+ rectangle: Rectangle ( LLX: 100 , LLY: 100 , URX: 0 , URY: 0 ) ,
339
+ formFieldName: " Signature1 " ,
340
+ authority: " Sergey Smal " ,
341
+ date: " 08/01/2012 12:15:00.000 PM " ,
342
+ showProperties: false ,
343
+ timestampSettings: nil ,
344
+ isValid: nil ,
345
+ customAppearance: nil )
346
+
347
+ let field = SignatureField (
348
+ links: nil ,
349
+ partialName: " Sign1 " ,
350
+ rect: Rectangle ( LLX: 100 , LLY: 100 , URX: 0 , URY: 0 ) ,
351
+ value: nil ,
352
+ pageIndex: 1 ,
353
+ height: nil ,
354
+ width: nil ,
355
+ zIndex: nil ,
356
+ isGroup: nil ,
357
+ parent: nil ,
358
+ isSharedField: nil ,
359
+ flags: nil ,
360
+ color: nil ,
361
+ contents: nil ,
362
+ margin: nil ,
363
+ highlighting: nil ,
364
+ horizontalAlignment: nil ,
365
+ verticalAlignment: nil ,
366
+ border: nil ,
367
+ signature: signature)
368
+
369
+ uploadFiles ( names: [ name, signatureName] ) {
370
+
371
+ PdfAPI . postSignatureField ( name: name, field: field, folder: self . tempFolder) {
372
+ ( response, error) in
373
+ guard error == nil else {
374
+ XCTFail ( " error testPostSignatureField: " + ( error. debugDescription) )
375
+ return
376
+ }
377
+
378
+ if let response = response {
379
+ XCTAssertEqual ( response. code, self . codeOk)
380
+
381
+ expectation. fulfill ( )
382
+ }
383
+ }
384
+ }
385
+
386
+ self . waitForExpectations ( timeout: testTimeout, handler: nil )
387
+ }
388
+
389
+ func testPutSignatureField( ) {
390
+
391
+ let name = " adbe.x509.rsa_sha1.valid.pdf "
392
+ let signatureName = " 33226.p12 "
393
+
394
+ let expectation = self . expectation ( description: " testPutSignatureField " )
395
+
396
+ let signature = Signature (
397
+ signaturePath: " \( self . tempFolder) / \( signatureName) " ,
398
+ signatureType: SignatureType . pkcs7,
399
+ password: " sIikZSmz " ,
400
+ appearance: nil ,
401
+ reason: nil ,
402
+ contact: " test@mail.ru " ,
403
+ location: " Ukraine " ,
404
+ visible: true ,
405
+ rectangle: Rectangle ( LLX: 100 , LLY: 100 , URX: 0 , URY: 0 ) ,
406
+ formFieldName: " Signature1 " ,
407
+ authority: " Sergey Smal " ,
408
+ date: " 08/01/2012 12:15:00.000 PM " ,
409
+ showProperties: false ,
410
+ timestampSettings: nil ,
411
+ isValid: nil ,
412
+ customAppearance: nil )
413
+
414
+ let field = SignatureField (
415
+ links: nil ,
416
+ partialName: " Sign1 " ,
417
+ rect: Rectangle ( LLX: 100 , LLY: 100 , URX: 0 , URY: 0 ) ,
418
+ value: nil ,
419
+ pageIndex: 1 ,
420
+ height: nil ,
421
+ width: nil ,
422
+ zIndex: nil ,
423
+ isGroup: nil ,
424
+ parent: nil ,
425
+ isSharedField: nil ,
426
+ flags: nil ,
427
+ color: nil ,
428
+ contents: nil ,
429
+ margin: nil ,
430
+ highlighting: nil ,
431
+ horizontalAlignment: nil ,
432
+ verticalAlignment: nil ,
433
+ border: nil ,
434
+ signature: signature)
435
+
436
+ uploadFiles ( names: [ name, signatureName] ) {
437
+
438
+ PdfAPI . putSignatureField ( name: name, fieldName: " Signature1 " , field: field, folder: self . tempFolder) {
439
+ ( response, error) in
440
+ guard error == nil else {
441
+ XCTFail ( " error testPutSignatureField: " + ( error. debugDescription) )
442
+ return
443
+ }
444
+
445
+ if let response = response {
446
+ XCTAssertEqual ( response. code, self . codeOk)
447
+
448
+ expectation. fulfill ( )
449
+ }
450
+ }
451
+ }
452
+
453
+ self . waitForExpectations ( timeout: testTimeout, handler: nil )
454
+ }
455
+
322
456
func testGetDocumentTextBoxFields( ) {
323
457
324
458
let name = " FormDataTextBox.pdf "
0 commit comments