Aspose::Pdf::Facades::PdfFileSecurity class

PdfFileSecurity class

Represents encrypting or decrypting a Pdf file with owner or user password, changing the security setting and password.

class PdfFileSecurity : public Aspose::Pdf::Facades::SaveableFacade

Methods

MethodDescription
BindPdf(System::String) overrideInitializes the facade.
BindPdf(System::SharedPtr<System::IO::Stream>) overrideInitializes the facade.
BindPdf(System::SharedPtr<Aspose::Pdf::Document>) overrideInitializes the facade.
virtual BindPdf(System::SharedPtr<Document>)Binds PDF document for editing.
ChangePassword(System::String, System::String, System::String)Changes the user password and owner password by owner password, keeps the original security settings. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. Throws an exception if process failed.
ChangePassword(System::String, System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize)Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. Throws an exception if process failed.
ChangePassword(System::String, System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize, Algorithm)Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. There are 6 possible combinations of KeySize and Algorithm values. However (KeySize.x40, Algorithm.AES) and (KeySize.x256, Algorithm.RC4) are invalid and corresponding exception will be raised if kit encounters this combination. Throws an exception if process failed.
Close() overrideCloses the facade.
get_AllowExceptions()If this value set to true, exception will be thrown on opearation failure. Else, method returns false on failure and last exception can be checked with LastException property.
get_Document() constGets the document facade is working on.
get_LastException() constReturns exception which was thrown by last operation.
MfDecryptFile(System::String)Decrypts an encrypted Pdf document by owner password. If the document hasn’t owner password, it is allow to use user password. Throws an exception if process failed.
MfEncryptFile(System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize)Encrypts Pdf file with userpassword and ownerpassword and sets the document’s privileges to access. The user password and the owner password can be null or empty. The owner password will be replaced with a random string if the input owner password is null or empty. Throws exception if process failed.
MfEncryptFile(System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize, Algorithm)Encrypts Pdf file with userpassword and ownerpassword and sets the document’s privileges to access. The user password and the owner password can be null or empty. The owner password will be replaced with a random string if the input owner password is null or empty. There are 6 possible combinations of KeySize and Algorithm values. However (KeySize.x40, Algorithm.AES) and (KeySize.x256, Algorithm.RC4) are invalid and corresponding exception will be raised if kit encounters this combination. Throws an exception if process failed.
PdfFileSecurity(System::SharedPtr<System::IO::Stream>, System::SharedPtr<System::IO::Stream>)Initialize the object of PdfFileSecurity with input and output stream.
PdfFileSecurity(System::String, System::String)Initializes the object of PdfFileSecurity with input and output file.
PdfFileSecurity()Initialize the object of PdfFileSecurity.
PdfFileSecurity(System::SharedPtr<Aspose::Pdf::Document>)Initializes new PdfFileSecurity object on base of the document .
PdfFileSecurity(System::SharedPtr<Aspose::Pdf::Document>, System::String)Initializes new PdfFileSecurity object on base of the document .
PdfFileSecurity(System::SharedPtr<Aspose::Pdf::Document>, System::SharedPtr<System::IO::Stream>)Initializes new PdfFileSecurity object on base of the document .
Save(System::String) overrideSaves the PDF document to the specified file.
Save(System::SharedPtr<System::IO::Stream>) overrideSaves the PDF document to the specified stream.
set_AllowExceptions(bool)If this value set to true, exception will be thrown on opearation failure. Else, method returns false on failure and last exception can be checked with LastException property.
set_InputFile(System::String)Sets the input file.
set_InputStream(System::SharedPtr<System::IO::Stream>)Sets the input stream.
set_OutputFile(System::String)Sets the output file.
set_OutputStream(System::SharedPtr<System::IO::Stream>)Sets the output stream.
SetPrivilege(System::SharedPtr<DocumentPrivilege>)Sets Pdf file security with empty user/owner passwords. The owner password will be added by a random string. Throws an exception if process failed.
SetPrivilege(System::String, System::String, System::SharedPtr<DocumentPrivilege>)Sets Pdf file security with original password. Throws an exception if process failed.
TryChangePassword(System::String, System::String, System::String)Changes the user password and owner password by owner password, keeps the original security settings. The new user password and the new owner password can be null or empty. The owner password will be replaced Does not throw an exception if process failed. with a random string if the new owner password is null or empty.
TryChangePassword(System::String, System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize)Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. Does not throw an exception if process failed.
TryChangePassword(System::String, System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize, Algorithm)Changes the user password and password by owner password, allows to reset Pdf documnent security. The new user password and the new owner password can be null or empty. The owner password will be replaced with a random string if the new owner password is null or empty. There are 6 possible combinations of KeySize and Algorithm values. However (KeySize.x40, Algorithm.AES) and (KeySize.x256, Algorithm.RC4) are invalid and corresponding exception will be raised if kit encounters this combination. Does not throw an exception if process failed.
TryDecryptFile(System::String)Decrypts an encrypted Pdf document by owner password. If the document hasn’t owner password, it is allow to use user password. Does not throw an exception if process failed.
TryEncryptFile(System::String, System::String, System::SharedPtr<DocumentPrivilege>, KeySize)Encrypts Pdf file with userpassword and ownerpassword and sets the document’s privileges to access. The user password and the owner password can be null or empty. The owner password will be replaced with a random string if the input owner password is null or empty. Does not throw an exception if process failed.
TrySetPrivilege(System::String, System::String, System::SharedPtr<DocumentPrivilege>)Sets Pdf file security with original password. Does not throw an exception if process failed.

See Also