Scan QR Code in C#.

QR codes are quite popular for exchanging information that can be scanned by a lot of devices. You might need to create an application to scan the QR Codes. Accordingly, this article explains how to scan a QR code programmatically in C#.

C# API Installation to Scan QR Code

You can work with Aspose.BarCode for .NET API to work with the QR Codes as well as various other types of barcodes. Simply configure the API by downloading the reference DLL files from the downloads section or run the following NuGet command in Visual Studio IDE.

PM> Install-Package Aspose.BarCode

Scan QR Code in C#

You can easily scan a QR Code with the following steps:

  1. Initialize an object of the BarCodeReader class along with the DecodeType parameter.
  2. Create an instance of BarCodeResult class.
  3. Scan the QR Code and get the result text.

The following code snippet elaborates how to scan a QR Code in C#:

Scan QR Code from a Stream in C#

The steps below explain how to read a QR code from a Stream in C#:

  1. Declare an instance of the BarcodeReader class and set the DecodeType property.
  2. Instantiate a BarCodeResult type object.
  3. Scan the QR Code and retrieve the output text.

The code sample below shows how to scan a QR code from a stream in C#:

Get a Free License

You can get a free temporary license to test all of the features of the API without any evaluation limitations.

Conclusion

In this article, you have understood how to scan a QR Code from a file or a stream with a few API calls. Moreover, you may take a look at the documentation space to inspect other features included in the API. In case of any queries, please feel free to contact us via the forum.

See Also