EncryptFile
Security and Signatures
Description
Encrypts a file on disk and saves the results to a new file. The entire document does not have to be loaded into memory so this function can be used to encrypt huge documents.
Syntax
Delphi
function TPDFlib.EncryptFile(Const InputFileName, OutputFileName, Owner, User: WideString; Strength, Permissions: Integer): Integer;ActiveX
Function PDFlib::EncryptFile(InputFileName As String, OutputFileName As String, Owner As String, User As String, Strength As Long, Permissions As Long) As LongDLL
int DLEncryptFile(int InstanceID, wchar_t * InputFileName, wchar_t * OutputFileName, wchar_t * Owner, wchar_t * User, int Strength, int Permissions);Parameters
| InputFileName | The name of the file to encrypt. |
|---|---|
| OutputFileName | The name of the destination file to create. |
| Owner | The owner password to use for the encrypted file. This is sometimes called the "master" password or the "permissions" password. This password will be needed to change the document. The user password to use for the encrypted file. This is sometimes called the "open" password, it will allow the user to open the document but not to use the document in ways not permitted. |
| User | |
| Strength | The strength of encryption to use: 0 = 40-bit RC4 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 Acorbat X or later) |
| Permissions | A value created with the EncodePermissions function |
Return values
| 0 | The file could not be encrypted. Check the result of the LastErrorCode |
|---|---|
| 1 | The document was encrypted successfully |