ByteScout Cloud API Server - Barcode Generator API - JavaScript - Generate Barcode - ByteScout

ByteScout Cloud API Server – Barcode Generator API – JavaScript – Generate Barcode

  • Home
  • /
  • Articles
  • /
  • ByteScout Cloud API Server – Barcode Generator API – JavaScript – Generate Barcode

How to generate barcode for barcode generator API in JavaScript with ByteScout Cloud API Server

Follow this simple tutorial to learn generate barcode to have barcode generator API in JavaScript

The sample source codes on this page will show you how to create barcode generator API in JavaScript. ByteScout Cloud API Server helps with barcode generator API in JavaScript. ByteScout Cloud API Server is the ready to use Web API Server that can be deployed in less than 30 minutes into your own in-house server or into private cloud server. Can store data on in-house local server based storage or in Amazon AWS S3 bucket. Processing data solely on the server using buil-in ByteScout powered engine, no cloud services are used to process your data!.

Want to learn quickly? These fast application programming interfaces of ByteScout Cloud API Server for JavaScript plus the instruction and the code below will help to learn how to generate barcode. Follow the tutorial and copy – paste code for JavaScript into your project’s code editor. Enjoy writing a code with ready-to-use sample JavaScript codes to implement barcode generator API using ByteScout Cloud API Server.

Trial version of ByteScout is available for free download from our website. This and other source code samples for JavaScript and other programming languages are available.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

generate_barcode.js
      
// Please NOTE: In this sample we're assuming Cloud Api Server is hosted at "https://localhost". // If it's not then please replace this with with your hosting url. function generateBarcode() { // Hide result blocks document.getElementById("errorBlock").style.display = "none"; document.getElementById("resultBlock").style.display = "none"; // Get barcode type var barcodeType=document.getElementById("barcodeType").value; // Get barcode value var inputValue = document.getElementById("inputValue").value.trim(); if (inputValue == null || inputValue == "") { alert("Barcode Value should not be empty."); return false; } //show loader showLoader(true); // Prepare URL var url = "https://localhost/barcode/generate?name=barcode.png"; url += "&type=" + barcodeType; // Set barcode type (symbology) url += "&value=" + inputValue; // Set barcode value // Prepare request var httpRequest = new XMLHttpRequest(); httpRequest.open("GET", url, true); // Asynchronous response handler httpRequest.onreadystatechange = function() { if (httpRequest.readyState == 4) { // If OK if (httpRequest.status == 200) { var result = JSON.parse(httpRequest.responseText); if (result.error == false) { document.getElementById("resultBlock").style.display = "block"; // show hidden resultBlock document.getElementById("image").setAttribute("src", result.url); // Set image link to display } else { document.getElementById("errorBlock").style.display = "block"; // show hidden errorBlock document.getElementById("error").innerHTML = result.message; } } // Else display error else { document.getElementById("errorBlock").style.display = "block"; // show hidden errorBlock document.getElementById("error").innerHTML = "Request failed. Please check you use the correct API key."; } // Hide loader showLoader(false); } } // Send request httpRequest.send(); return true; } function showLoader(isDisplay){ var loader = document.getElementById("loader"); if(isDisplay){ loader.style.display = ""; } else{ loader.style.display="none"; } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Cloud API Server Home Page

Explore ByteScout Cloud API Server Documentation

Explore Samples

Sign Up for ByteScout Cloud API Server Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Cloud API Server Home Page

Explore ByteScout Cloud API Server Documentation

Explore Samples

Sign Up for ByteScout Cloud API Server Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next