How to Generate a UPC-A Barcode as a PNG File with JavaScript

Are you struggling to scale your ecommerce operation with increased demand for your products? Our Barcode APIs can help with that. You can put your UPC-A Barcode needs to rest with our UPC-A Generating API; it’ll generate fresh barcodes as PNGs for every new numerical barcode value. With the JavaScript code examples we’ve provided below from our API documentation page, you can quickly and easily structure your API call — you just need to first create a free account on our website to receive your API key, and then you’ll be good to go.

Your first step is installing jQuery. Let’s take care of that with the following command:

bower install jquery

With installation complete, you’re now one step away from finishing entirely. Use the below code to structure your API call:

var settings = {
"url": "https://api.cloudmersive.com/barcode/generate/upc-a",
"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);
});

Pretty easy, right? No need to worry about generating UPC-A barcodes anymore.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store