0.9.0 • Published 1 year ago

barcode-2-svg-string v0.9.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

barcode-2-svg-string

Create svg file on server/browser side without canvas Work well in all modern browser it's modificated version of JQUERY PLUGIN : BARCODE Generate 1D barcodes

Supported types

Requirements

  • node >= 0.10.0
  • browser != IE

Installing

npm install barcode-2-svg

Usage

Set it up and specify your type and options. The following 3 are the only required ones.

var barcode = require('barcode-2-svg');
//return barcode like text
var code13Text = barcode("9234567890128", "ean13", {width:50, barWidth:1, barHeight:50});
console.log(code13Text);

type (string)

  • codabar
  • code11 (code 11)
  • code39 (code 39)
  • code93 (code 93)
  • code128 (code 128)
  • ean8 (ean 8)
  • ean13 (ean 13)
  • std25 (standard 2 of 5 - industrial 2 of 5)
  • int25 (interleaved 2 of 5)

settings (object):

  • barHeight (int) -height of svg (default: 30);
  • width (int) -width of svg (default: 100);
  • bgColor (text) -background color css like (default: 'transparent');
  • color (text) -barcode color (default: '#000000');
  • showHRI (boolean) -do show HRI, number in the bottom from the barcode image (default: 0)
  • marginHRI (number) -space between barcode and HRI (default: 0)

License

The MIT License (MIT)