status = doc:SetPassword(ownerpwd[, userpwd])
doc:SetPassword()
sets a password for the document.
If the password is set, document contents are encrypted.
The owner can change the permission of the document. Note
that the owner password must not be the same as the user
password. The user password is optional.
When doc:SetPassword()
succeeds, it returns #HPDF_OK
. Otherwise, it returns an error code and the error handler is called.
#HPDF_INVALID_DOCUMENT
- An invalid document handle was set.
#HPDF_FAILED_TO_ALLOC_MEM
- Memory allocation failed.
#HPDF_INVALID_PASSWORD
- Owner password is Nil
, zero length string, or same value as user password.