In the modern era, the digitally signed PDFs with QR code have become more secure and quickly verifiable for automated digital processing systems. Another good reason to use QR codes is that they are capable of containing a lot of useful information. If you are keen to learn how to eSign PDF files with QR code in C#, you have landed at the right place.
The following points will be covered in this article:
- C# Library to Digitally Sign PDF with QR Code
- Steps to Digitally Sign PDF with QR Code in C#
- Digitally Sign PDF with QR Code in C# - Advanced Options
C# Library to Digitally Sign PDF with QR Code
You can download the DLL or install it by running the command (as given below) in the NuGet package manager console.
Install-Package GroupDocs.Signature
Steps to Digitally Sign PDF with QR Code in C#
After installation, let’s start to write a few lines of code.
Please follow the steps and the code snippet mentioned below:
- Instantiate the Signature class and pass the source document’s path as a constructor parameter.
- Initialize an instance of QrCodeSignOptions class and set EncodeType and Text properties.
- Invoke Sign method of Signature class and pass output file’s path and QrCodeSignOptions to it.
You can simply copy & paste the following code sample into your C# file:
The output can be seen in the image below:
eSign PDF with QR code in C# - Advanced Options
PDF eSign library provides some additional useful options in QrCodeSignOptions class. You can use this class to specify signature alignment, margins, borders, font, colors, and background. Moreover, you can verify the results of a newly created signature by using SignResult class.
Following are the steps to create QR Code with advanced options:
- Initialize a new instance of the Signature class by providing the source document’s path as a constructor parameter.
- Instantiate an instance of the QrCodeSignOptions class.
- Set the signature’s text and encoding type.
- Set the signature’s position.
- Specify the signature’s alignment, margins, borders, font, colors, and background.
- Invoke Sign method of Signature class and pass output file’s path and QrCodeSignOptions to it.
- Optionally you can obtain SignResult object to analyze or verify the newly created signatures.
The following C# code shows how to sign a PDF with QR code using advanced options:
You will get the output as seen in the image below:
Get a Free License
You can avail a free temporary license to test the API without evaluation limitations.
Conclusion
In this article, we have learned how to Digitally Sign PDF with QR Code in C# using an electronic signature library. Besides, you also have gained knowledge about some advanced options to add the QR Code Sign in your PDF documents. You may visit the documentation to know about other features of the digital signature library.
Additionally, we suggest you to follow our Getting Started guide.
Ask a question
You can let us know about your questions or queries on our forum.