Generate a UPC-E Barcode in Node.JS

Cloudmersive
2 min readDec 17, 2020

--

In North America, the most commonly used format for barcodes is the UPC format. UPC-A is the full format, containing 12 digits, while UPC-E is the condensed version of this and only contains 6 digits with a seventh check digit. The following API will allow you to generate a UPC-E barcode image using Node.JS. Be advised that it is recommended to only use a UPC-E barcode for an item with packaging that is too small to contain a full UPC-A barcode.

Run this command to install the SDK:

npm install cloudmersive-barcodeapi-client --save

Or add this snippet to your package.json:

"dependencies": {
"cloudmersive-barcodeapi-client": "^1.1.2"
}

Then, call the function:

var CloudmersiveBarcodeapiClient = require('cloudmersive-barcodeapi-client');
var defaultClient = CloudmersiveBarcodeapiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveBarcodeapiClient.GenerateBarcodeApi();var value = "value_example"; // String | UPC-E barcode value to generate fromvar callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.generateBarcodeUPCE(value, callback);

This will return a downloadable PNG image containing your barcode. You can retrieve the API Key from the Cloudmersive website at no cost and with no commitment. This will provide you with 800 monthly calls across our library of APIs.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.