This short tutorial will show you how to add image signature to PDF using C#. We will utilize a popular signature library to sign a PDF document using an image signature. A few API calls and three-four lines of code will be used to achieve this feature. Finally, a working example to sign PDF with image in C# is provided.
Steps to Add Image Signature to PDF using C#
- Configure GroupDocs.Signature for .NET from NuGet package manager in the application
- Add a reference to the necessary namespaces for adding image signature to the PDF
- Initialize Signature class and load the source PDF document
- Create an object of the ImageSignOptions class and pass the signature image to its constructor
- Consume the Sign method of the Signature class for signing PDF document with an image signature
The instructions for implementing the functionality to insert signature image in PDF using C# are pretty straightforward. We will start the implementation of these steps by configuring the required package from NuGet in the project and adding the necessary namespaces for signing the document. After that, we will load the source PDF document and set the signature position for the signed PDF file using ImageSignOptions class. Finally, the signed PDF document is saved to the disk with the help of the Sign method.
Code to Add Image Signature to PDF using C#
In the preceding sample code, we have followed the aforementioned instructions to add signature image to PDF in C#. We have defined a few properties for the signature position in this example. However, you may modify this example and set other properties such as Border settings, Height, Width, Horizontal alignment, Vertical alignment, and many more.
In this post, we have looked at how to add an image signature to a PDF document using C# and included some sample code. You may visit our previous guide on How to Add Digital Signature to PDF in C# for additional information.