PDF Signature
The Documentize PDF Signature for .NET plugin allows users to digitally sign PDF documents. It offers a streamlined process for adding signatures, ensuring authenticity, and securing PDF content. The plugin supports both visible and invisible signatures and provides options to customize the signature’s position, reason, contact information, and more.
Key Features:
- Digitally Sign PDF Documents: Secure your documents with visible or invisible digital signatures.
- PFX Support: Sign PDF files using a PFX certificate.
- Customizable Options: Configure signature settings like reason, location, and contact details.
- Visible and Invisible Signatures: Choose whether the signature is visible on the document.
How to Sign PDF Documents
To sign a PDF document using a PFX file, follow these steps:
- Create an instance of the
Signature
class. - Instantiate the
SignOptions
class with the PFX file path and password. - Add the input PDF and the output file to the options.
- Run the
Process
method to apply the signature.
1var signature = new Signature();
2var signOptions = new SignOptions(@"C:\certificates\myCertificate.pfx", "pfxPassword");
3
4// Add the input PDF and specify the output file
5signOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
6signOptions.AddOutput(new FileDataSource(@"C:\Samples\signedOutput.pdf"));
7
8// Configure signature options
9signOptions.Reason = "Contract Agreement";
10signOptions.Contact = "johndoe@example.com";
11signOptions.Location = "New York";
12signOptions.PageNumber = 1;
13signOptions.Visible = true;
14signOptions.Rectangle = new Rectangle(100, 100, 200, 150);
15
16// Apply the signature to the document
17signature.Process(signOptions);
How to Use Stream for PFX File
You can also sign a PDF using a PFX certificate provided as a stream instead of a file path. This allows more flexible handling of certificate storage.
- Create an instance of the
Signature
class. - Instantiate
SignOptions
with a stream containing the PFX and the password. - Add the input and output files.
- Run the
Process
method to apply the signature.
1using var pfxStream = File.OpenRead(@"C:\certificates\myCertificate.pfx");
2var signature = new Signature();
3var signOptions = new SignOptions(pfxStream, "pfxPassword");
4
5// Add input and output files
6signOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
7signOptions.AddOutput(new FileDataSource(@"C:\Samples\signedOutput.pdf"));
8
9// Apply signature
10signature.Process(signOptions);
How to Apply Invisible Signatures
To add an invisible signature (one that secures the document without displaying the signature on the document), simply set the Visible
property to false
.
- Create an instance of
SignOptions
. - Set
Visible
tofalse
. - Add input and output files.
- Call
Process
to apply the invisible signature.
1var signature = new Signature();
2var signOptions = new SignOptions(@"C:\certificates\myCertificate.pfx", "pfxPassword");
3
4// Configure invisible signature
5signOptions.Visible = false;
6
7// Add input and output files
8signOptions.AddInput(new FileDataSource(@"C:\Samples\input.pdf"));
9signOptions.AddOutput(new FileDataSource(@"C:\Samples\invisiblySigned.pdf"));
10
11// Process signature
12signature.Process(signOptions);