Encrypt
Security and Signatures
Description
This function adds the specified security settings to the selected document.
The actual encryption of the document is delayed until the document is saved so this function can be called at any time, even before further content is added to the document.
Syntax
Delphi
function TPDFlib.Encrypt(Const Owner, User: WideString; Strength, Permissions: Integer): Integer;ActiveX
Function PDFlib::Encrypt(Owner As String, User As String, Strength As Long, Permissions As Long) As LongDLL
int DLEncrypt(int InstanceID, wchar_t * Owner, wchar_t * User, int Strength, int Permissions);Parameters
| Owner | The owner or master password for the document |
|---|---|
| User | The user password for the document |
| Strength | The strength of encryption to use: 0 = 40-bit encryption 1 = 128-bit RC4 encryption 2 = 128-bit AES encryption (requires Acrobat 7 or later) 3 = 256-bit AES encryption (requires Acrobat 9 or later) 4 = 256-bit AES encryption (requires Acrobat X or later) |
| Permissions | A value created with the EncodePermissions function |
Return values
| 0 | The document could not be encrypted. Use the LastErrorCode function to determine the reason for failure. The document was encrypted successfully |
|---|---|
| 1 |