How to read barcodes in JavaScript using Cloud API (low level) - ByteScout

How to read barcodes in JavaScript using Cloud API (low level)

  • Home
  • /
  • Articles
  • /
  • How to read barcodes in JavaScript using Cloud API (low level)

The sample below will demonstrate how to read barcodes in JavaScript using ByteScout Cloud API (low level).

Also, see the following tutorial: How to generate barcodes in JavaScript.

POST/GET endpoint:

https://api.pdf.co/v1/barcode/read/from/url

Code Sample:

var Bytescoutio = require('bytescoutio');
var defaultClient = Bytescoutio.ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['x-api-key'] = "Token"

var api = new Bytescoutio.DefaultApi()

var opts = { 
  'types': types_example, // {String} Comma-separated list of barcode types to decode. Valid types: AustralianPostCode, Aztec, CircularI2of5, Codabar, CodablockF, Code128, Code16K, Code39, Code39Extended, Code39Mod43, Code39Mod43Extended, Code93, DataMatrix, EAN13, EAN2, EAN5, EAN8, GS1, GS1DataBarExpanded, GS1DataBarExpandedStacked, GS1DataBarLimited, GS1DataBarOmnidirectional, GS1DataBarStacked, GTIN12, GTIN13, GTIN14, GTIN8, IntelligentMail, Interleaved2of5, ITF14, MaxiCode, MICR, MicroPDF, MSI, PatchCode, PDF417, Pharmacode, PostNet, PZN, QRCode, RoyalMail, RoyalMailKIX, Trioptic, UPCA, UPCE, UPU.
  'pages': pages_example, // {String} Comma-separated list of page indices (or ranges) to process. Leave empty for all pages. Example: '0,2-5,7-'.
  'url': url_example // {String} URL of the image to decode barcodes from.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.barcodeReadFromUrlPost(opts, callback);

Tutorials:

prev
next