Convert to a password-encrypted PDF file in C# and .NET


    Difference between OwnerPassword and UserPassword.

    PDF Metamorphosis .Net and p.PdfSettings.PdfSecurity.UserPassword = "0987654321";

The user password will be required to open an encrypted PDF document for viewing.
The permissions specified in SautinSoft.Document.PdfEncryptionDetails.Permissions will be enforced by the reader software.
The user password can be null or empty string, in this case no password will be required from the user when opening the PDF document. The user password cannot be the same as the owner password.

For example, if you open PDF file in an Viewer and insert the password - "0987654321", you will see, that you may READ only of this PDF file because you are the user of this file:
Document Properties -> Security -> Document Restrictions Summary -> Not Allowed.

User password security

    PDF Metamorphosis .Net and p.PdfSettings.PdfSecurity.OwnerPassword = "1234567890";

The owner password allows the user to open an encrypted PDF document without any access restrictions specified in SautinSoft.Document.PdfEncryptionDetails.Permissions.
The owner password cannot be the same as the user password. If you don't specify an owner password, then the system will generate a random password when generating the PDF document.

For example, if you open PDF file in an Viewer and insert the password - "1234567890", you will see, that you may edit, printing this PDF file because you are the owner of this file:
Document Properties -> Security -> Document Restrictions Summary -> Allowed.

Owner password security

Полный код


Если вам нужен пример кода или у вас есть вопрос: напишите нам по адресу support@sautinsoft.ru или спросите в онлайн-чате (правый нижний угол этой страницы) или используйте форму ниже:



Вопросы и предложения всегда приветствуются!

Мы разрабатываем компоненты .Net с 2002 года. Мы знаем форматы PDF, DOCX, RTF, HTML, XLSX и Images. Если вам нужна помощь в создании, изменении или преобразовании документов в различных форматах, мы можем вам помочь. Мы напишем для вас любой пример кода абсолютно бесплатно.