ASP.NET Core QR Code Barcode with a .NET Standard/.NET Core DLL

This Visual Studio project illustrates how to generate a QR Code barcode in ASP.NET Core with a .NET Standard/.NET Core DLL. The NETStandardQRCode.dll, available in, validates the input data, generates barcode codewords and creates the necessary error correction characters. The following C# snippet illustrates how to use the DLL to generate a QR Code barcode.

        using Microsoft.AspNetCore.Mvc.RazorPages;
        using Net.ConnectCode.BarcodeFontsStandard2D;
        namespace ASPNETCoreQRCodeSample.Pages
            public class IndexModel : PageModel
                public string Message { get; set; }

                public void OnGet()
                   QR qrCode = new QR("12345678","M",8);                       
                   string output=qrCode.Encode();
                   Message = output;


Input Data: elementBarcode.innerHTML (or any other input string)

Error Correction Level: "L" ("L", "M", "Q" or "H")

L - Allows recovery of up to 7% data loss
M - Allows recovery of up to 15% data loss
Q - Allows recovery of up to 25% data loss
H - Allows recovery of up to 30% data loss

Mask: 8 (0 to 7 or 8 for Auto)

The purpose of a mask pattern is to make the QR code easier for a QR scanner to read.

Text Output

The NETStandardQRCode.dll generates a text output for easy integration into your application as shown below:


A 1 represents a black square and a 0 represents a white square. Each row ends with an OS environment newline, "\r\n" for non-Unix platforms or "\n" for Unix platforms.

Rendering the QR Code Barcode

The output can be easily rendered on a HTML5 Canvas through a JavaScript function or displayed directly with a Web Open Font Format (WOFF) barcode font. For example, if you have the following HTML5 Canvas tag in your HTML web page.

         <canvas id="barcodeCanvas" width=300 height=300>@Model.Message</canvas>              

You can use the following function in qrcodecanvas.js to render the barcode onto the Canvas.


You will get the following QR Code Barcode that meets the strictest requirements required by the auto-id industry.

QR Code Barcode with .NET Standard DLL and Barcode Web Fonts

You can also use the Web Open Font Format (WOFF) QR Code fonts provided by ConnectCode to display the barcodes. For example, using the following div tag in your HTML web page:

        <div id="barcodeFonts" style="white-space: pre-line">@Model.Message</div>             

You can use the Cascading Style Sheets (CSS) @font-face feature to specify an online font (the WOFF QR Code font) for display on web pages. Please refer to site.css for more details.

        @font-face {
            font-family: CCodeQR;
            src: url("fonts/CCodeQR_Trial.eot");
            src: local("CCodeQR_Trial"), 
                 url("fonts/CCodeQR_Trial.otf") format("opentype"),             
                 url("fonts/CCodeQR_Trial.woff") format("woff");

Next, apply the font-face to the barcodeFonts div element:

        #barcodeFonts {
            font-weight: normal;
            font-style: normal;
            line-height: normal;
            font-family: 'CCodeQR', sans-serif;                 
            font-size: 12px;

You will get the following QR Code Barcode generated using WOFF Barcode Font (W3C Compliant) that meets the strictest requirements required by the auto-id industry.

Supported Browsers and Platforms

ConnectCode Certified

  • Internet Explorer 11 (Windows 7/8/10)
  • Microsoft Edge (Windows 8/10)
  • Opera 40+ (Windows)
  • Google Chrome 61+ (Windows)
  • Google Chrome 61+ (OS X/macOS)
  • Safari 5.1+ (OS X/macOS)
  • iOS Mobile Browser (iOS 10.0+)
  • Android Mobile Browser (Android 4.0+)
+ Current and newer versions

Please note that though our QR Code Barcode Web Fonts/HTML5 Canvas solution works on many more browsers, we currently only provide technical support for the above-mentioned certified browsers.

QR Code .NET Standard DLL

  • .NET Standard 2.0+
Download QR Code Barcode package.

Back to QR Code Barcode Fonts.