Generate QR Code in C#.

A QR code is a two-dimensional barcode that can be used to store some useful data for identifying or tracking information. Sometimes you may need to create a QR code to embed information in the form of vertical and horizontal grids. Accordingly, this article explains how to generate a QR Code programmatically in C#.

C# API Installation to Generate QR Code

You need to install Aspose.BarCode for .NET API. It can be used to create or scan different kind of barcodes. You may download the reference DLL files or install it with the following NuGet command.

PM> Install-Package Aspose.BarCode

Generate QR Code in C#

You can generate a QR Code by following the steps below:

  1. Initialize an instance of the BarcodeGenerator class while specifying the EncodeType and the input text.
  2. Set the version and encoding type for the QR Code.
  3. Generate a QR Code and save the output image in PNG format.

The code snippet below shows how to generate a QR Code in C#:

Generate QR Code with ForceQR Encoding in C#

Here you will learn how to create a ForceQR type of QR code in C#.

  1. Initialize an instance of the BarcodeGenerator class while specifying the EncodeType and the input text.
  2. Set the version and encoding type for the QR Code.
  3. Create a QR Code and write the generated QR code as a PNG image.

The following code example demonstrates how to generate a QR code with ForceQR encoding in C#:

Get a Free License

You may request a free temporary license to evaluate the API in its full capacity.

Conclusion

In this article, you have learned how to generate a QR Code with different versions and encoding types programmatically in C#. Besides, may visit the documentation section to explore various other features offered by Aspose.BarCode for .NET API. In case of any questions, please feel free to write to us at the forum.

See Also