How to Generate a UPC-E Barcode in JavaScript

Cloudmersive
1 min readJun 11, 2021

--

The UPC-E barcode is essentially a condensed version of standard UPC-A code; with this barcode format, you can take an original 12-digit value and compress it to 6 digits with an accompanying seventh checksum digit. These are not equipped to convey complex information but can be a great option for retail. If this sounds like it fits the bill for you, the following API can be used to quickly and easily generate an image of a UPC-E barcode.

Let’s begin the process by installing the jQuery library:

bower install jquery

Once the installation is complete, you can input the value and call the function:

var settings = {
"url": "https://api.cloudmersive.com/barcode/generate/upc-e",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Apikey": "YOUR-API-KEY-HERE"
},
"data": {
"0": "<",
"1": "s",
"2": "t",
"3": "r",
"4": "i",
"5": "n",
"6": "g",
"7": ">"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});

This will instantly return a downloadable PNG file containing your new barcode!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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