JavaScript Barcode Scanner SDK

Realize Advantages of Barcode Reading in Document Management

Many industries and countless companies rely on barcode technology for streamlining workflows, ensuring accuracy, and enhancing productivity in their document management web applications.

Supports Mainstream Browsers

  • Gives end-users the flexibility of browser choice with support for Internet Explorer, Edge, Firefox, and Chrome on Windows, macOS, Linux, and mobile browsers too.

Client-Side Barcode Scanning

  • Dynamsoft provides JavaScript APIs to help you easily implement barcoding in your web applications with just a few lines of JavaScript code. Scan linear barcodes, QR Code, DataMatrix, PDF417, and more.

Industrial-Grade Performance

  • Realize highly accurate and fast decoding performance to meet small or large barcode task requirements for scanning common 1D and 2D barcodes.

Easy Integration and End-User Distribution

  • An MSI installer is available for IT managers to do batch installations easily on their networks.
  • Client-side language support: JavaScript, JQuery, VBScript, HTML5, HTML.
  • Since there is no dependency on any third-party framework, any web server is supported, such as Nginx, IIS, Tomcat, Apache, and more.
  • Server-side programming language support: ASP.NET (C#/VB.NET), PHP, JSP, ASP, etc.

Technical Architecture

Dynamsoft's Barcode Reader add-on has two implementations:

  • A WebAssembly-based JavaScript implementation. This enables barcode recognition in mobile browsers, as well as modern desktop browsers. It does not require installation on the client side. Browser compatibility:

    Browser Name Version
    Firefox v52+ on Windows/macOS/Linux; v55+ on Android/iOS
    Chrome v57+ on Windows/macOS/Linux; v59+ on Android/iOS
    Safari v11+ on macOS/iPad/iPhone (Safari 11.2.2 ~ 11.2.6 are not supported)
    Microsoft Edge v16+
  • A Windows Service based implementation. This implementation requires installation on the client side. The Windows Service receives user operation commands from the JavaScript client and passes on the request to a barcode recognition DLL. It then passes the barcode results to the JavaScript client. Browser compatibility:

    Browser Name Version
    Firefox for Windows v27+
    Chrome for Windows v27+
    Internet Explorer v10+
    Microsoft Edge All

Code Snippet to Scan Documents and Read Barcodes

function AcquireImage() {         
    DWObject.IfDisableSourceAfterAcquire = true;    
    DWObject.SelectSource();                              
    DWObject.OpenSource();                         
    DWObject.AcquireImage();                       
}              
function ReadBarcode(){
    if (!dbrObject) return;
    var barcodeImage = DWObject.GetImagePartURL(DWObject.CurrentImageIndexInBuffer);

    dbrObject.decode(barcodeImage).then(OnBarcodeReadSuccess, OnBarcodeReadFailure);
}
function OnBarcodeReadSuccess(results) {
    var strMsg = "";
    if(results.length > 0) {
        for (var i = 0; i < results.length; i++){
            var result = results[i];
            strMsg +="Index: " + i + "\n";
            strMsg += "Barcode Type: " + result.BarcodeFormatString + "\n";
            strMsg += "Barcode Value: " + result.BarcodeText + "\n";       
        }
        console.log(strMsg);
    }
    else
        alert("No barcode(s) found.");
}
function OnBarcodeReadFailure(ex) {
    alert(ex.message || ex);
}