PdfFileSecurity

PdfFileSecurity class

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

The PdfFileSecurity type exposes the following members:

Constructors

NameDescription
PdfFileSecurity(input_stream, output_stream)Initializes a new instance of the PdfFileSecurity class
PdfFileSecurity(input_file, output_file)Initializes a new instance of the PdfFileSecurity class
PdfFileSecurity()Initialize the object of PdfFileSecurity.
PdfFileSecurity(document)Initializes a new instance of the PdfFileSecurity class
PdfFileSecurity(document, output_file)Initializes a new instance of the PdfFileSecurity class
PdfFileSecurity(document, output_stream)Initializes a new instance of the PdfFileSecurity class

Properties

NameDescription
documentGets the document facade is working on.
allow_exceptionsIf 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.

Methods

NameDescription
bind_pdf(src_file)Initializes the facade.
bind_pdf(src_stream)Initializes the facade.
bind_pdf(src_doc)Binds PDF document for editing.
save(dest_file)Saves the PDF document to the specified file.
save(dest_stream)Saves the PDF document to the specified stream.
encrypt_file(user_password, owner_password, privilege, key_size)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.
encrypt_file(user_password, owner_password, privilege, key_size, cipher)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.
set_privilege(privilege)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.
set_privilege(user_password, owner_password, privilege)Sets Pdf file security with original password.
Throws an exception if process failed.
change_password(owner_password, new_user_password, new_owner_password)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.
change_password(owner_password, new_user_password, new_owner_password, privilege, key_size)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.
change_password(owner_password, new_user_password, new_owner_password, privilege, key_size, cipher)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.
try_change_password(owner_password, new_user_password, new_owner_password)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.
try_change_password(owner_password, new_user_password, new_owner_password, privilege, key_size)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.
try_change_password(owner_password, new_user_password, new_owner_password, privilege, key_size, cipher)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.
close()Closes the facade.
try_encrypt_file(user_password, owner_password, privilege, key_size)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.
decrypt_file(owner_password)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.
try_decrypt_file(owner_password)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.
try_set_privilege(user_password, owner_password, privilege)Sets Pdf file security with original password.
Does not throw an exception if process failed.

See Also