iamlawrencev / QRCodeGenerator-Xamarin.Forms

A QR code generator in Xamarin.Forms using the QRCoder library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QR Code Generator in Xamarin Forms

Info

This is a simple QR Code Generator using codebude's QRCoder library in Xamarin.Forms. This is meant to be used as a guide as I have seen countless examples that use the ZXING library to create QR codes and I wanted to show an even easier way to do that.

Screenshots

Screenshot1 Screenshot1

Installation

See QRCoder's readme. Also check the wiki page for advanced usage.

Usage

You only need these few lines of code to generate your own QR code in Xamarin.Forms and that's it. Just bind it to an Image's Source property and you're done.

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(InputText, SelectedECCLevel);
PngByteQRCode qRCode = new PngByteQRCode(qrCodeData);
byte[] qrCodeBytes = qRCode.GetGraphic(20);
QrCodeImage = ImageSource.FromStream(() => new MemoryStream(qrCodeBytes));

I have tested the other renderers aside from PngByteQRCode but only this along with BitmapByteQRCode and AsciiQRCode work.

About

A QR code generator in Xamarin.Forms using the QRCoder library.

License:MIT License


Languages

Language:C# 100.0%