BarcodeQRCodeSDK 2.1.0

.NET 6.0
dotnet add package BarcodeQRCodeSDK --version 2.1.0
NuGet\Install-Package BarcodeQRCodeSDK -Version 2.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BarcodeQRCodeSDK" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BarcodeQRCodeSDK --version 2.1.0
#r "nuget: BarcodeQRCodeSDK, 2.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install BarcodeQRCodeSDK as a Cake Addin
#addin nuget:?package=BarcodeQRCodeSDK&version=2.1.0

// Install BarcodeQRCodeSDK as a Cake Tool
#tool nuget:?package=BarcodeQRCodeSDK&version=2.1.0

.NET 6 Barcode and QR Code Reader SDK

.NET Barcode and QR Code SDK

The .NET 6 Barcode and QR Code Reader SDK is a C++/CLI wrapper for Dynamsoft C++ Barcode Reader SDK.

SDK Version

v9.0

License Activation

Click here to get a valid license key.

Supported Platforms

  • Windows (x64)
  • Linux (x64)
  • macOS (x64)

Supported Barcode Symbologies

  • Linear Barcodes (1D)

    • Code 39 (including Code 39 Extended)
    • Code 93
    • Code 128
    • Codabar
    • Interleaved 2 of 5
    • EAN-8
    • EAN-13
    • UPC-A
    • UPC-E
    • Industrial 2 of 5
  • 2D Barcodes

    • QR Code (including Micro QR Code and Model 1)
    • Data Matrix
    • PDF417 (including Micro PDF417)
    • Aztec Code
    • MaxiCode (mode 2-5)
    • DotCode
  • Patch Code

  • GS1 Composite Code

  • GS1 DataBar

    • Omnidirectional,
    • Truncated, Stacked, Stacked
    • Omnidirectional, Limited,
    • Expanded, Expanded Stacked
  • Postal Codes

    • USPS Intelligent Mail
    • Postnet
    • Planet
    • Australian Post
    • UK Royal Mail

Download .NET 6 SDK

Methods

  • public static void InitLicense(string license)
  • public static BarcodeQRCodeReader Create()
  • public Result[]? DecodeFile(string filename)
  • public Result[]? DecodeBuffer(IntPtr pBufferBytes, int width, int height, int stride, ImagePixelFormat format)
  • public Result[]? DecodeBase64(string base64string)
  • public static string? GetVersionInfo()
  • public void SetParameters(string parameters)

Usage

  • Set the license key:

    BarcodeQRCodeReader.InitLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ=="); 
    
  • Initialize the barcode and QR code reader object:

    BarcodeQRCodeReader? reader = BarcodeQRCodeReader.Create();
    
  • Decode barcode and QR code from an image file:

    Result[]? results = reader.DecodeFile(filename);
    
  • Decode barcode and QR code from a base64 string:

    Result[]? results = reader.DecodeBase64(base64string);
    
  • Decode barcode and QR code from a buffer:

    BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
    ImageLockMode.ReadWrite, bitmap.PixelFormat);
    
    BarcodeQRCodeReader.ImagePixelFormat format = BarcodeQRCodeReader.ImagePixelFormat.IPF_ARGB_8888;
    
    switch (bitmap.PixelFormat)
    {
        case PixelFormat.Format24bppRgb:
            format = BarcodeQRCodeReader.ImagePixelFormat.IPF_RGB_888;
            break;
        case PixelFormat.Format32bppArgb:
            format = BarcodeQRCodeReader.ImagePixelFormat.IPF_ARGB_8888;
            break;
        case PixelFormat.Format16bppRgb565:
            format = BarcodeQRCodeReader.ImagePixelFormat.IPF_RGB_565;
            break;
        case PixelFormat.Format16bppRgb555:
            format = BarcodeQRCodeReader.ImagePixelFormat.IPF_RGB_555;
            break;
        case PixelFormat.Format8bppIndexed:
            format = BarcodeQRCodeReader.ImagePixelFormat.IPF_GRAYSCALED;
            break;
    }
    
    Result[]? results = reader.DecodeBuffer(bmpData.Scan0, bitmap.Width, bitmap.Height, bmpData.Stride, format);
    bitmap.UnlockBits(bmpData);
    
  • Get SDK version number:

    string? version = BarcodeQRCodeReader.GetVersionInfo();
    
  • Customize parameters:

    // Refer to https://www.dynamsoft.com/barcode-reader/parameters/structure-and-interfaces-of-parameters.html?ver=latest
    reader.SetParameters("{\"Version\":\"3.0\", \"ImageParameter\":{\"Name\":\"IP1\", \"BarcodeFormatIds\":[\"BF_QR_CODE\", \"BF_ONED\"], \"ExpectedBarcodesCount\":20}}");
    

Quick Start

using System;
using System.Runtime.InteropServices;
using Dynamsoft;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            BarcodeQRCodeReader.InitLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ=="); // Get a license key from https://www.dynamsoft.com/customer/license/trialLicense?product=dbr
            BarcodeQRCodeReader? reader = null;
            try {
                reader = BarcodeQRCodeReader.Create();
                Console.WriteLine("Please enter an image file: ");
                string? filename = Console.ReadLine();
                if (filename != null) {
                    Result[]? results = reader.DecodeFile(filename);
                    if (results != null) {
                        foreach (Result result in results) {
                            Console.WriteLine(result.Text);
                        }
                    }
                    else {
                        Console.WriteLine("No barcode found.");
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Destroy();
                }
            }
        }
    }
}

Example

Building NuGet Package from Source Code

dotnet build --configuration Release
Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 988 7/15/2022
2.0.1 903 5/18/2022
2.0.0 184 5/12/2022
1.2.1 503 5/7/2022
1.2.0 280 3/31/2022
1.1.0 171 3/29/2022
1.0.11 159 3/29/2022
1.0.10 167 3/29/2022

- Updated Dynamsoft Barcode Reader to v9.2.