0
I need to create a color qrcode using zxing.net however I can’t and I can’t find 1 tutorial on the internet even searching and trying for days, Does anyone have any idea how to develop 1 color qrcode using zxing and c#/.net. Help here my code to generate the qrcode.
CODE:
public static class QRHelper
{
public static IHtmlString GenerateQrCode(this HtmlHelper html, string url)
{
int QRCODE_IMAGE_HEIGHT = 496;
int QRCODE_IMAGE_WIDTH = 496;
var qrWriter = new BarcodeWriter();
qrWriter.Format = BarcodeFormat.QR_CODE;
var BackgroundColor = Color.White;
var ModuleColor = Color.Green;
qrWriter.Options = new EncodingOptions() { Height = QRCODE_IMAGE_HEIGHT, Width = QRCODE_IMAGE_WIDTH };
var ms = new MemoryStream();
var q = qrWriter.Write(url);
q.Save(ms, ImageFormat.Png);
var img = new TagBuilder("img");
string alt = "QR code";
img.Attributes.Add("src", String.Format("data:image/png;base64,{0}", Convert.ToBase64String(ms.ToArray())));
img.Attributes.Add("alt", alt);
return MvcHtmlString.Create(img.ToString(TagRenderMode.SelfClosing));
}
}
What is the library version?
– Leandro Angelo
I am using version 0.16.2.
– Marcelo Henrique Dos Reis