Generate barcode image with Javascript (.JS) script and Bytescout BarCode SDK - ByteScout

Generate barcode image with Javascript (.JS) script and Bytescout BarCode SDK

  • Home
  • /
  • Articles
  • /
  • Generate barcode image with Javascript (.JS) script and Bytescout BarCode SDK

Output barcodes (Code 39 and Aztec 2D barcodes):

Code 39 barcode generated with Bytescout BarCode SDK from Javascript (.JS) script Aztec 2d barcode image generated with Bytescout BarCode SDK in Javascript

The following sample provides a sample .JS javascript code to use Barcode SDK from javascript to generate 1D and 2D barcodes. Bytescout BarCode SDK can be called from both Visual Basic .NET (as .NET assembly) and ActiveX compatible languages like Javascript, VBScript, Visual Basic 6 and other.

HelloWorld.js content:

var bc = WScript.CreateObject(‘Bytescout.BarCode.Barcode’);

// set symbology to Code39
bc.Symbology = 1; // 1 = Code39 symbology type

// set barcode value to encode
bc.Value = “012345”;

// Saving Code39 barcode to ‘Code39.png’

bc.SaveImage (“Code39.png”);

// Encoding ‘012345’ using Aztec symbology

// set symbology to Aztec (2D)
// bc.Symbology = 17; // 17 = Aztec

// set barcode value to encode
bc.Value = “012345”;

// Encoding ‘012345’ using Aztec symbology” & vbCRLF & bc.GetValueRestrictions(17), where 17 = Code39 symbology

bc.SaveImage (“Aztec.png”);

bc = null

Tutorials:

prev
next