Digitally Sign PDF with QR Code in C#

Digitally Sign PDF with QR Code in C#

In the modern era, digitally signed PDFs with QR code are more secure and instantly verifiable for automated processing systems. QR codes also store a large amount of useful data. If you want to eSign PDF files with a QR code in C#, you are in the right place.

The article covers:

C# Library to Digitally Sign PDF with QR Code

You can download the DLL or install it via the NuGet package manager console:

Install-Package GroupDocs.Signature

Steps to Digitally Sign PDF with QR Code in C#

After installation, write the following code.

  1. Create a Signature object with the source document path.
  2. Create a QrCodeSignOptions object and set the EncodeType and Text properties.
  3. Call the Sign method of the Signature object, passing the output path and the QrCodeSignOptions.

Copy and paste this sample into your C# file:

The result appears as shown below:

QR Code Sign

eSign PDF with QR code in C# - Advanced Options

The PDF eSign library offers additional settings in the QrCodeSignOptions class. Use these options to define alignment, margins, borders, font, colors, and background. You can also verify the signature using the SignResult class.

Steps for advanced QR code signing:

  1. Create a new Signature object with the source document path.
  2. Instantiate a QrCodeSignOptions object.
  3. Set the signature text and encoding type.
  4. Define the signature position.
  5. Configure alignment, margins, borders, font, colors, and background.
  6. Call Sign on the Signature object, passing the output path and the options.
  7. Optionally retrieve a SignResult object to analyze the new signature.

Advanced C# code example:

The output looks like this:

eSign PDF

Get a Free License

You can obtain a free temporary license to test the API without evaluation limits.

Conclusion

This article shows how to digitally sign PDF with QR Code in C# using an electronic signature library. It also covers advanced options for adding QR code signatures to PDF documents. Visit the documentation for more features of the digital signature library.

Additionally, follow our Getting Started guide.

Ask a question

Post your questions or queries on our forum.

See Also