Navigation:  DominoPDF > Helper Functions >

Function: DomPDFEncrypt

Previous pageReturn to chapter overviewNext page

The DomPDFEncrypt function is used to encrypt an existing PDF file.

Note: The DomPDFEncrypt function does not support encrypting an already encrypted PDF file. If encryption of an already encrypted PDF file is required please contact Primeapple for details.

LOTUSSCRIPT

Declarations

Declare Function DomPDFEncrypt Lib "DOMINOPDF.DLL" (Byval szInput As String, Byval szOwnerPass As String,_

Byval szUserPass As String, Byval iAllowPrint As Long, Byval iAllowCopy As Long,_

Byval iAllowChange As Long, Byval iAllowAnnotate As Long, Byval iAllowFields As Long,_

Byval iAllowCopyAccess As Long, Byval iAllowAssemble As Long, Byval iAllowPrintFull As Long,_

Byval iStrength As Long) As Long

Return Value

Returns 0 if successful or -1 if unsuccessful.

Syntax

szInput - The file name and path of the PDF file to be encrypted.

For example;

c:\contacts.pdf

c:\my documents\contacts.pdf

szOwnerPass - Specify the owner password to apply to PDF documents.

szUserPass - Specify the user password to apply to PDF documents.

iAllowPrint - Set this to 1 to allow the user to print the PDF document.

iAllowCopy - Set this to 1 to allow the user to copy text and graphics from the PDF document.

iAllowChange - Set this to 1 to allow the user to edit the PDF document.

iAllowAnnotate - Set this to 1 to allow the user to add annotations to the PDF document.

iAllowFields - Set this to 1 to allow the user to fill in form fields. Only works with 128-bit encryption strength (see iStrength).

iAllowCopyAccess - Set this to 1 to enable copying for use with accessibility features. Only works with 128-bit encryption (see iStrength).

iAllowAssemble - Set this to 1 to allow the user to assemble the PDF document. Only works with 128-bit encryption (see iStrength).

iAllowPrintFull - Set this to 0 to force low-resolution printing of the PDF document only. This prevents the document from being distilled into a new PDF document. Only works with 128-bit encryption (see iStrength).

iStrength - The strength of encryption to use: 0 = Standard 40-bit encryption. 1 = Advanced 128-bit encryption.

Example

Sub Initialize

'Declare variables...

Dim sInput As String

 

'Set values...

sInput = |c:\test.PDF|

 

'Error handler...

On Error Goto Error_Handler

 

'Encrypt PDF files...

Call DomPDFEncrypt(sInput, "OwnerPass", "UserPass", 1, 1, 1, 1, 1, 1, 1, 1, 1)

 

The_End:

Exit Sub

 

Error_Handler:

Print Error$

Resume The_End

End Sub