PDF Security
The Documentize PDF Security for .NET is a powerful tool designed to enhance the security of your PDF documents by providing encryption and decryption capabilities. It ensures that your sensitive information remains confidential and protected from unauthorized access.
Key Features:
- Encrypt PDF Documents: Secure your PDF files by adding user and owner passwords.
- Decrypt PDF Documents: Remove encryption from PDFs when needed.
- Set Permissions: Control permissions such as printing, copying, and modifying content.
- Automation: Integrate encryption and decryption into your .NET applications for automated workflows.
- Compliance: Ensure your documents meet industry standards for document security.
How to Encrypt a PDF Document
To encrypt a PDF document, follow these steps:
- Create an instance of the
Security
class. - Create an instance of
EncryptionOptions
with the desired user and owner passwords. - Add the input PDF file using the
AddInput
method. - Set the output file path using
AddOutput
. - Execute the encryption using the
Process
method.
1// Instantiate the Security plugin
2var plugin = new Security();
3
4// Configure the encryption options
5var opt = new EncryptionOptions("user_password", "owner_password");
6
7// Add input PDF file
8opt.AddInput(new FileDataSource("path_to_pdf"));
9
10// Specify the output encrypted PDF file
11opt.AddOutput(new FileDataSource("path_to_encrypted_pdf"));
12
13// Perform the encryption process
14plugin.Process(opt);
How to Decrypt a PDF Document
To decrypt a PDF document, follow these steps:
- Create an instance of the
Security
class. - Create an instance of
DecryptionOptions
with the necessary password. - Add the encrypted PDF file using the
AddInput
method. - Set the output file path using
AddOutput
. - Execute the decryption using the
Process
method.
1// Instantiate the Security plugin
2var plugin = new Security();
3
4// Configure the decryption options
5var opt = new DecryptionOptions("user_password");
6
7// Add input encrypted PDF file
8opt.AddInput(new FileDataSource("path_to_encrypted_pdf"));
9
10// Specify the output decrypted PDF file
11opt.AddOutput(new FileDataSource("path_to_decrypted_pdf"));
12
13// Perform the decryption process
14plugin.Process(opt);
Setting Permissions on PDF Documents
When encrypting a PDF, you can set various permissions to control how the document can be used.
- Printing: Allow or disallow printing of the document.
- Copying: Allow or disallow copying of content.
- Modifying: Allow or disallow modifications to the document.
To set permissions, you can configure the EncryptionOptions
accordingly.