PDF Encryption

The following example shows how to use GemBox.Presentation to convert any presentation to encrypted PDF file with restricted permissions which requires a password to be decrypted, viewed and, optionally, modified.

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

class Program
{
    static void Main()
    {
        // If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        var presentation = PresentationDocument.Load("%InputFileName%");

        string password = "%Password%";
        string ownerPassword = "%OwnerPassword%";

        var options = new PdfSaveOptions()
        {
            DocumentOpenPassword = password,
            PermissionsPassword = ownerPassword,
            Permissions = PdfPermissions.None
        };

        presentation.Save("PDF Encryption.pdf", options);
    }
}
Imports GemBox.Presentation

Module Program

    Sub Main()

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

        Dim presentation = PresentationDocument.Load("%InputFileName%")

        Dim password As String = "%Password%"
        Dim ownerPassword As String = "%OwnerPassword%"

        Dim options = New PdfSaveOptions() With
        {
            .DocumentOpenPassword = password,
            .PermissionsPassword = ownerPassword,
            .Permissions = PdfPermissions.None
        }

        presentation.Save("PDF Encryption.pdf", options)
    End Sub
End Module
PDF encryption set with GemBox.Presentation
Screenshot of PDF encryption set with GemBox.Presentation

See also


Next steps

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

Download Buy