PdfFileSecurity

PdfFileSecurity class

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

public sealed class PdfFileSecurity : SaveableFacade

Constructors

Name Description
PdfFileSecurity() Initialize the object of PdfFileSecurity.
PdfFileSecurity(Document) Initializes new PdfFileSecurity object on base of the document.

Properties

Name Description
Document { get; } Gets the document facade is working on.
LastException { get; } Returns exception which was thrown by last operation.

Methods

Name Description
virtual BindPdf(Document) Initializes the facade.
override BindPdf(Stream) Initializes the facade.
override BindPdf(string) Initializes the facade.
ChangePassword(string, string, 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(string, string, string, 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(string, string, string, 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.
override Close() Closes the facade.
DecryptFile(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.
Dispose() Disposes the facade.
EncryptFile(string, string, 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.
EncryptFile(string, string, 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.
virtual Save(Stream) Saves the PDF document to the specified stream.
virtual Save(string) Saves the PDF document to the specified file.
SetPrivilege(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(string, string, DocumentPrivilege) Sets Pdf file security with original password. Throws an exception if process failed.
TryChangePassword(string, string, 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(string, string, string, 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(string, string, string, 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(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(string, string, 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(string, string, DocumentPrivilege) Sets Pdf file security with original password. Does not throw an exception if process failed.

See Also