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. 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 document manipulation, data conversion, 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 to whether they respond to your needs and requirements for the project.

Our website provides a free trial version of PDF.co Web API 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"; var oData = { name: 'barcode.png', type: $("#barcodeType").val(), // Set barcode type (symbology) value: $("#inputValue").val() // Set barcode value }; $.ajax({ url: url, type: "POST", data: oData, 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: