## PdfFileSecurity::SetPrivilege(const System::SharedPtr\<DocumentPrivilege\>\&) method


Sets [Pdf](../../../aspose.pdf/) file security with empty user/owner passwords. The owner password will be added by a random string. Throws an exception if process failed.

```cpp
bool Aspose::Pdf::Facades::PdfFileSecurity::SetPrivilege(const System::SharedPtr<DocumentPrivilege> &privilege)
```


| Parameter | Type | Description |
| --- | --- | --- |
| privilege | const System::SharedPtr\<DocumentPrivilege\>\& | Set privilege. |

### ReturnValue

True for success.

## See Also

* Typedef [SharedPtr](../../../system/sharedptr/)
* Class [DocumentPrivilege](../../documentprivilege/)
* Class [PdfFileSecurity](../)
* Namespace [Aspose::Pdf::Facades](../../)
* Library [Aspose.PDF for C++](../../../)
## PdfFileSecurity::SetPrivilege(const System::String\&, const System::String\&, const System::SharedPtr\<DocumentPrivilege\>\&) method


Sets [Pdf](../../../aspose.pdf/) file security with original password. Throws an exception if process failed.

```cpp
bool Aspose::Pdf::Facades::PdfFileSecurity::SetPrivilege(const System::String &userPassword, const System::String &ownerPassword, const System::SharedPtr<DocumentPrivilege> &privilege)
```


| Parameter | Type | Description |
| --- | --- | --- |
| userPassword | const System::String\& | Original user password. |
| ownerPassword | const System::String\& | Original owner password. |
| privilege | const System::SharedPtr\<DocumentPrivilege\>\& | Set privilege. |

### ReturnValue

True for success.

## See Also

* Class [String](../../../system/string/)
* Typedef [SharedPtr](../../../system/sharedptr/)
* Class [DocumentPrivilege](../../documentprivilege/)
* Class [PdfFileSecurity](../)
* Namespace [Aspose::Pdf::Facades](../../)
* Library [Aspose.PDF for C++](../../../)
