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

Generate EAN Labels with JavaScript via C++

Create EAN (International Article Number) barcode in JavaScript using server-side Aspose.BarCode for JavaScript via C++ API.

How to Generate EAN barcode Using JavaScript via C++

To generate EAN barcode, download latest release of Aspose.BarCode for JavaScript , a robust 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 to Generate EAN barcode in JavaScript

Aspose.BarCode makes it easy for developers to create EAN barcode images with few lines of code.

  • Create instance of BarCode module
  • Create an instance of BarcodeGenerator class
  • Pass EAN (International Article Number) barcode type as a parameter
  • Set text to encode as the second parameter
  • Specify barcode dimensions if required
  • Call the BarcodeGenerator.GenerateBarCodeImage method to obtain the EAN (International Article Number) barcode image

System Requirements

Aspose barcode APIs are supported by all major platforms and operating systems. Before executing the code sample below, please check that you have the following prerequisites enabled in your system.

  • 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/).

Code to be executed - JavaScript


// instantiate object and set different barcode properties
var generator = new BarCodeInstance.BarcodeGenerator("EAN", "");

// Set parameters
generator.Parameters.Barcode.XDimension = "2px";
generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.Below;

// Generate image    
const img = generator.GenerateBarCodeImage();

// Display image
document.getElementById("generatedImage").src = img;

// Save image
generator.Save("generated.png");

// Cleanup resources
generator.delete()
×
Generated barcode image