Methods to define document encryption


setPasswords()


Sets passwords for PDF and Word document protection.

PDF syntax:

setPasswords(tcOwnerPassword, tcUserPassword)

Parameters:

The user password (tcUserPassword) can be empty. If the owner password (tcOwnerPassword) is empty, a random string will be generated as the password. 
The owner can do anything with the document. The user permissions can be set using the setPermissions() methods.

Word syntax:

setPasswords(tcReadPassword, tcWritePassword, tlRequirePassword)

You can omit either tcReadPassword or tcWritePassword. tlRequirePassword is optional (default value is .F.). If set to .T., Word will ask for the password even when the document is being opened first time after the generation (if DoNotOpenViewer property is set to .F.).

setPermissions()



Sets the user permissions in the PDF document.

Syntax:

setPermissions(tlPrintDocument, tlModifyDocument, tlCopyTextAndGraphics, tlAddOrModifyAnnotations)