Encrypt PPTX files in C# and VB.NET

The following example shows how to use the GemBox.Presentation library to load an encrypted PPTX file and how to save a presentation as an encrypted PPTX file.

Upload your file (Drag file here)
using GemBox.Presentation;

// If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY");

string inputPassword = "inpass";
string outputPassword = "outpass";

var presentation = PresentationDocument.Load("PptxEncryption.pptx", new PptxLoadOptions() { Password = inputPassword });
presentation.Save("PPTX Encryption.pptx", new PptxSaveOptions() { Password = outputPassword });
Imports GemBox.Presentation

Module Program

Sub Main()

' If using the Professional version, put your serial key below.
ComponentInfo.SetLicense("FREE-LIMITED-KEY")

Dim inputPassword As String = "inpass"
Dim outputPassword As String = "outpass"

Dim presentation = PresentationDocument.Load("PptxEncryption.pptx", New PptxLoadOptions With {.Password = inputPassword})
presentation.Save("PPTX Encryption.pptx", New PptxSaveOptions With {.Password = outputPassword})
End Sub
End Module
PPTX encryption set with GemBox.Presentation
Screenshot of PPTX encryption set with GemBox.Presentation

Next steps

GemBox.Presentation is a .NET library that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.