Install-Package QRCoder
The “QRCoder” DLL helps to generate QR code with just four lines of code in C#.
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(qrText, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(20);
Create an instance of the QRCodeGenerator class.
QRCodeGenerator qrGenerator = new QRCodeGenerator();
The next step is to initialize QR code data using the CreateQrCode method, which takes two arguments, i.e., string text for encoding inside the QR code, and another case defines the error correction level, i.e., ECCLevel.
Here, four different levels L (7%), M (15%), Q (25%) and H (30%) are available, whereby the percentage represents the hidden portion of the QR-code until the error correction algorithm can’t recreate the original message encoded in the QR code.
QRCodeData qrCodeData = qrGenerator.CreateQrCode(qrText, QRCodeGenerator.ECCLevel.Q);
#qr-code #qrcodegenerator #programming #dotnet #dotnet-core #visual studio code