Name
doc:SetPassword -- set document password
Synopsis
status = doc:SetPassword(ownerpwd[, userpwd])
Function
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.

Inputs
ownerpwd
the password for the owner of the document
userpwd
optional: the password for the user of the document.
Results
status
status code
Errors
#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.


Show TOC