23
23
// </summary>
24
24
// --------------------------------------------------------------------------------------------------------------------
25
25
26
+ using System ;
26
27
using System . IO ;
27
28
using System . Net ;
29
+ using System . Text ;
28
30
using Aspose . Pdf . Cloud . Sdk . Model ;
29
31
using NUnit . Framework ;
30
32
@@ -398,6 +400,19 @@ public void GetPdfInStorageToPptxTest()
398
400
Assert . That ( response . Length , Is . GreaterThan ( 0 ) ) ;
399
401
}
400
402
403
+ /// <summary>
404
+ /// Test GetPdfInStorageToPptxWithPassword
405
+ /// </summary>
406
+ [ Test ]
407
+ public void GetPdfInStorageToPptxTestWithPassword ( )
408
+ {
409
+ string name = "4pagesEncrypted.pdf" ;
410
+ UploadFile ( name , name ) ;
411
+ Stream response = PdfApi . GetPdfInStorageToPptx ( name , folder : TempFolder ,
412
+ password : Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( @"user $^Password!&" ) ) ) ;
413
+ Assert . That ( response . Length , Is . GreaterThan ( 0 ) ) ;
414
+ }
415
+
401
416
/// <summary>
402
417
/// Test PutPdfInStorageToPptx
403
418
/// </summary>
@@ -412,6 +427,20 @@ public void PutPdfInStorageToPptxTest()
412
427
Assert . That ( response . Code , Is . EqualTo ( 200 ) ) ;
413
428
}
414
429
430
+ /// <summary>
431
+ /// Test PutPdfInStorageToPptxWithPassword
432
+ /// </summary>
433
+ [ Test ]
434
+ public void PutPdfInStorageToPptxTestWithPassword ( )
435
+ {
436
+ string name = "4pagesEncrypted.pdf" ;
437
+ UploadFile ( name , name ) ;
438
+ string resFileName = "result.pptx" ;
439
+ var response = PdfApi . PutPdfInStorageToPptx ( name , Path . Combine ( TempFolder , resFileName ) , folder : TempFolder ,
440
+ password : Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( @"user $^Password!&" ) ) ) ;
441
+ Assert . That ( response . Code , Is . EqualTo ( 200 ) ) ;
442
+ }
443
+
415
444
/// <summary>
416
445
/// Test PutPdfInRequestToPptx
417
446
/// </summary>
@@ -428,6 +457,21 @@ public void PutPdfInRequestToPptxTest()
428
457
}
429
458
}
430
459
460
+ /// <summary>
461
+ /// Test PutPdfInRequestToPptxWithPassword
462
+ /// </summary>
463
+ [ Test ]
464
+ public void PutPdfInRequestToPptxTestWithPassword ( )
465
+ {
466
+ string name = "4pagesEncrypted.pdf" ;
467
+ using ( Stream stream = System . IO . File . OpenRead ( Path . Combine ( TestDataFolder , name ) ) )
468
+ {
469
+ string resFileName = "result.pptx" ;
470
+ var response = PdfApi . PutPdfInRequestToPptx ( Path . Combine ( TempFolder , resFileName ) , file : stream ,
471
+ password : Convert . ToBase64String ( Encoding . UTF8 . GetBytes ( @"user $^Password!&" ) ) ) ;
472
+ Assert . That ( response . Code , Is . EqualTo ( 200 ) ) ;
473
+ }
474
+ }
431
475
432
476
/// <summary>
433
477
/// Test GetPdfInStorageToTeX
0 commit comments