Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
In today's digitally driven world, QR code (Quick Response Code) has become ubiquitous, seamlessly connecting physical and digital realms. From marketing to logistics, finance to healthcare, QR codes play a pivotal role in facilitating efficient data exchange.
In this article, we delve into the realm of C# development, exploring how IronQR, one of the best QR code libraries in the market, empowers developers to harness the power of QR code recognition through, decode data effortlessly, and innovate across various domains.
IronQR from Iron Software stands out as a robust .NET QR code reader library. The advanced machine learning model implemented by IronQR empowers your applications to decode QR codes with unmatched accuracy and efficiency, even in challenging scenarios.
IronQR stands out as the premier C# QR code reader library designed to both scan QR code and generate QR code images within the .NET framework. Through the utilization of cutting-edge ML technology, IronQR has elevated QR code reading to unprecedented levels.
Whether you are scanning QR codes from images, videos, or live camera feeds, the ML-powered solution guarantees swift and reliable information retrieval.
This innovative approach not only streamlines data extraction but also enhances security by discerning between authentic QR codes and potential threats. With its intuitive API, developers can seamlessly integrate QR code capabilities into their .NET projects in a matter of minutes.
IronQR seamlessly integrates with .NET Core (8, 7, 6, 5, and 3.1+), .NET Standard (2.0+), and .NET Framework (4.6.2+). The present .NET Core version extends its support to client operating systems like Linux, Unix, and macOS, along with compatibility to develop on mobile apps.
Let's get started by creating a Windows forms .NET application to read QR code barcodes from camera video streams or image files. Open Visual Studio, Select Create New Project, and then select .NET Windows Forms application template
Click Next and Enter the Project Name
Select the desired .NET Versions and then click the create button
IronQR can be installed using NuGet package manager or Visual Studio Package Manager
Below shows how you can do it using Visual Studio
To scan QR codes from camera devices, we need to install AForgeCore.Video.DirectShow library, This can be done using the Visual Studio package manager like below. Right-click on solution explorer and open Package Manager.
This library can also be installed using the NuGet package console like below. Click the install button to install the library
The next Step is to create a PictureBox component in the Form, this is required to scan the QR code image from the camera device connected to the machine.
This can be done by dragging and dropping from the toolbox. This PictureBox is required to read the QR code data from the camera device
Next, we need to drag and drop a Text box to show the read QR codes.
Add the below code to read QR codes and decode them using IronQR.
using AForge.Video.DirectShow;
using AForge.Video;
using System.Drawing;
using IronQr;
namespace ReadQR
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load += Form1_Load;
this.FormClosing += Form1_FormClosing;
}
private VideoCaptureDevice videoSource;
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (videoSource != null && videoSource.IsRunning)
{
videoSource.SignalToStop();
videoSource.WaitForStop();
}
}
private void Form1_Load(object sender, EventArgs e)
{
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count > 0)
{
videoSource = new VideoCaptureDevice(videoDevices [0].MonikerString);
videoSource.NewFrame += VideoSource_NewFrame;
videoSource.Start();
}
else
{
MessageBox.Show("No video devices found.");
Close();
}
}
private void VideoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
// Update the picture box with the new frame from the camera.
pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
var image = (Bitmap)eventArgs.Frame.Clone();
// Set the license key
License.LicenseKey = "YourKey";
// Load QrImageInput
QrImageInput imageInput = new QrImageInput(image);
// QR Reader object
QrReader reader = new QrReader();
// Read QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// display results
MessageBox.Show(results.First().Value);
}
}
}
using AForge.Video.DirectShow;
using AForge.Video;
using System.Drawing;
using IronQr;
namespace ReadQR
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Load += Form1_Load;
this.FormClosing += Form1_FormClosing;
}
private VideoCaptureDevice videoSource;
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (videoSource != null && videoSource.IsRunning)
{
videoSource.SignalToStop();
videoSource.WaitForStop();
}
}
private void Form1_Load(object sender, EventArgs e)
{
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
if (videoDevices.Count > 0)
{
videoSource = new VideoCaptureDevice(videoDevices [0].MonikerString);
videoSource.NewFrame += VideoSource_NewFrame;
videoSource.Start();
}
else
{
MessageBox.Show("No video devices found.");
Close();
}
}
private void VideoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
// Update the picture box with the new frame from the camera.
pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
var image = (Bitmap)eventArgs.Frame.Clone();
// Set the license key
License.LicenseKey = "YourKey";
// Load QrImageInput
QrImageInput imageInput = new QrImageInput(image);
// QR Reader object
QrReader reader = new QrReader();
// Read QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// display results
MessageBox.Show(results.First().Value);
}
}
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
The encoded Text in the QR code is: I Love IronQR
IronQR requires a license key. A trial key can be obtained from the website here. This key needs to be placed in appsettings.json.
{
"IronQR.LicenseKey":"MYLICENSE.KEY.TRIAL"
}
Provide the email ID to get a trial license and after submitting, the key will be delivered via email.
In conclusion, QR codes have transcended their origins to become indispensable in our digital ecosystem. With IronQR, C# developers can harness the power of QR code recognition, decode data in various types of QR codes with ease, and innovate across various domains.
As QR codes continue to evolve and integrate into new technologies, their importance in facilitating seamless data exchange and enhancing user experiences will only grow. Embrace the potential of QR codes with IronQR and embark on a journey of innovation and efficiency in C# development.
9 .NET API products for your office documents