PNG JPG BMP TIFF SVG
Aspose.BarCode  for JavaScript via C++
QR

Read QR Barcodes with JavaScript via C++

Read QR Code, GS1 QR Code in JavaScript using server-side Aspose.BarCode for JavaScript via C++ API

How to Read QR Code Using JavaScript via C++

To scan QR Code, try Aspose.BarCode for JavaScript , a potent and easy-to-use barcode library with rich functionality that works in any moder browser. Download the latest version directly from the Releases Site and then follow installation instructions .

Command

<script type="text/javascript" src="Aspose.BarCode.JS.Cpp.js" async onload="initializeModule()"></script>
<script>
// Global BarCode module instance
var BarCodeInstance;

// Async function for module initialization
async function initializeModule() {
    try {
        BarCodeInstance = await BarCode();
        console.log('BarCode module has loaded');
        // Enable barcode-related controls here
    } catch (error) {
        console.error("BarCode module initialization error:", error);
    }
}
</script>

Steps for Scanning QR Code in JavaScript

Aspose.BarCode allows developers to read QR Code barcodes from stream or image with few lines of code

  • Create instance of BarCode module
  • Create a new instance of Aspose.BarCode.BarCodeReader class
  • Pass the source image path containing QR Code, GS1 QR Code as a parameter
  • Pass an appropriate DecodeType as the second parameter
  • Loop through the decoding results
  • Get barcode text using the CodeText property

System Requirements

Aspose APIs are supported on all major platforms and operating systems. Before executing the code sample below, please make sure that your system comply with the following requirements.

  • Aspose.BarCode for JavaScript via C++ is independent of any specific operating system, allowing it to function on any platform that supports a compatible browser or runtime environment. This includes major operating systems such as Windows, macOS, Linux, iOS, and Android. For detailed technical requirements, see [System Requirements](https://docs.aspose.com/barcode/javascript-cpp/system-requirements/).
Ready to recognize Recognizing Drop a file here or click to browse *

* By uploading your files or using the service you agree with our Terms of use and Privacy Policy.

Code to be executed - JavaScript

    var reader = new BarCodeInstance.BarCodeReader("<file name>", "QR");
reader.ReadBarCodes();

//Display found barcodes count
const count = reader.FoundCount;
console.log('Barcodes found: ' + count);

// Ensure there are barcodes found
if (count > 0) {
    // Iterate through each found barcode
    for (let i = 0; i < count; i++) {
        // Retrieve the barcode at the current index
        const res = reader.FoundBarCodes(i);
        
        // Print the code text of the barcode
        console.log(`Barcode ${i + 1}: ${res.CodeText}`);
    }
} else {
    console.log('No barcodes found.');
}

// Cleanup resources
reader.delete()
×
Barcode image

Other Supported Barcode Recognition Symbologies

Using JavaScript via C++, One can also read barcode of different symbologies including the following.

2D:

Linear:

Postal: