# HaruDoc::setPassword

(PECL haru:0.0.1)

HaruDoc::setPassword — Set owner and user passwords for the document

### Description

bool HaruDoc::setPassword ( string `$owner_password` , string `$user_password` )

Defines owner and user passwords for the document. Setting the passwords makes the document contents encrypted.

### Parameters

`owner_password`

  The password of the owner, which can change permissions of the document. Empty password is not accepted. Owner's password cannot be the same as the user's password.

`user_password`

  The password of the user. Can be empty.

### Return Values

Returns `TRUE` on success.

### Errors/Exceptions

Throws HaruException on error.

### See Also

- HaruDoc::setEncryptionMode()
- HaruDoc::setPermission()