Last active
July 5, 2021 11:42
-
-
Save aspose-com-kb/6e05105ae56cb11de1a5310807e873fc to your computer and use it in GitHub Desktop.
Secure PowerPoint Presentation using Password Encryption in C#. The step by step guide on this gist is here https://kb.aspose.com/slides/net/how-to-secure-powerpoint-presentation-in-csharp-net/.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
//Install Aspose.Slides for .NET NuGet package | |
//and then utilize the following namespace to | |
//secure PowerPoint presentation | |
using Aspose.Slides; | |
using Aspose.Slides.Export; | |
namespace SecurePowerPointPresentation | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//Set Aspose license before securing PowerPoint presentation | |
//using Aspose.Slides for .NET | |
Aspose.Slides.License AsposeSlidesLicense = new Aspose.Slides.License(); | |
AsposeSlidesLicense.SetLicense(@"c:\asposelicense\license.lic"); | |
//create an object of Presentation class from Aspose.Slides namespace | |
//and provide the PowerPoint presentation to secure in the constructor | |
Presentation PowerPointPresentationToSecure = new Presentation("PowerPointPresentationToSecure.pptx"); | |
//specify the password with which you want to secure the presentation | |
//this can be taken as input password from the user/admin etc. | |
String PasswordForPresentationSecurity = "8ma2bzdqgo"; | |
//Encrypt or secure the presentation with the password using Encrypt method | |
//with the help of ProtectionManager | |
PowerPointPresentationToSecure.ProtectionManager.Encrypt(PasswordForPresentationSecurity); | |
//Finally, save the output presentation secured with password | |
//provide PPTX as save format | |
PowerPointPresentationToSecure.Save("PresentationSecuredWithPassword.pptx",Aspose.Slides.Export.SaveFormat.Pptx); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment