Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 1.05 KB

File metadata and controls

12 lines (9 loc) · 1.05 KB

Encrypt PDF with a password in C# and VB.NET

This sample shows how to protect your PDF document with a password in C# and VB.NET.

When encrypting with a password, there are two password types: "user" and "owner" passwords. Opening a PDF document with an "owner" password allows you to do everything with it. Opening a PDF document with a "user" password allows only operations specified by the user access permissions.

To protect the document, first, create an instance of the PdfStandardEncryptionHandler class with user and owner passwords. Then assign the handler to the PdfSaveOptions.EncryptionHandler property.

See also