How to generate barcode (jquery) for barcode generator API in JavaScript and PDF.co Web API

Tutorial: how to generate barcode (jquery) for barcode generator API in JavaScript

These source code samples are listed and grouped by their programming language and functions they use. PDF.co Web API was made to help with barcode generator API in JavaScript. PDF.co Web API is the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf.

JavaScript code samples for JavaScript developers help to speed up the application’s code writing when using PDF.co Web API. Follow the instruction and copy – paste code for JavaScript into your project’s code editor. Test JavaScript sample code examples whether they respond your needs and requirements for the project.

Our website provides free trial version of PDF.co Web API that includes source code samples to help with your JavaScript project.

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

      
$(document).ready(function () { $("#resultBlock").hide(); $("#errorBlock").hide(); }); $(document).on("click", "#submit", function () { var apiKey = $("#apiKey").val().trim(); // Get your API key by registering at https://app.pdf.co/documentation/api var url = "https://api.pdf.co/v1/barcode/generate?name=barcode.png"; url += "&type=" + $("#barcodeType").val(); // Set barcode type (symbology) url += "&value=" + $("#inputValue").val(); // Set barcode value $.ajax({ url: url, type: "GET", headers: { "x-api-key": apiKey }, }) .done (function(data, textStatus, jqXHR) { if (data.error == false) { $("#resultBlock").show(); $("#image").attr("src", data.url); } else { $("#errorBlock").show(); $("#error").html(data.message); } }) .fail (function(jqXHR, textStatus, errorThrown) { $("#errorBlock").show(); $("#error").html("Request failed. Please check you use the correct API key."); }); });

VIDEO

ON-PREMISE OFFLINE SDK

Get 60 Day Free Trial

See also:

ON-DEMAND REST WEB API

Get Your API Key

See also:

Related Samples: