JavaScript Barcode Scanner SDK

Client-Side Barcode Scanning in Web Applications

Need barcode reading functionality in your web application? Dynamsoft provides JavaScript APIs to help you easily implement that. With a few lines of JavaScript code, you can develop a robust web application to scan a linear barcode, QR Code, DataMatrix, and PDF417 online.

Read Barcodes from Mainstream Browsers on Windows

Your end users will have the flexibility on browsers: Internet Explorer version 6 and above, Edge, Firefox, and Chrome. The support for other platforms (macOS, Linux, and mobile) will be available soon.

Support mainstream browsers on Windows

Easy Integration and End-User Distribution

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

Technical Architecture

Dynamsoft's barcode add-on is composed of three layers: a JavaScript client, a Windows Service, and a core function DLL.

Browser JavaScript Client

  • This is the JavaScript library. It communicates with the Windows service. It accepts the operation requests from users and sends them to the service.

Windows Service

  • This module receives user operation commands from a JavaScript client. It listens on localhost and handles the interface with barcode recognition DLL and passes the response to the JavaScript layer. Users only need to install the service once.

Barcode recognition DLL

  • Barcode recognition DLL is where the barcode detection and decoding actually happens.

Code snippet on how to scan documents and read barcode

function AcquireImage() {         
    DWObject.IfDisableSourceAfterAcquire = true;    
    DWObject.SelectSource();                              
    DWObject.OpenSource();                         
    DWObject.AcquireImage();                       
}              
function ReadBarcode(){
    if (!dbrObject) return;
    var barcodeImage = DWObject.GetImageURL(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);
}