datalog / barcode-svg

128 Barcode generator written on pure javascript. Lightweight and cross browser with highly optimized SVG nodes.
MIT License
34 stars 8 forks source link
barcode barcode-generator html5-ready javascript standalone svg

SVG BAR Code Generator

Barcode svg generator LICENSE

128 Barcode generator written on pure javascript. Produces highly optimized SVG nodes.

Barcode svg generator (Live demo)

Easy to start

After barcode.min.js is downloaded and connected to your html5 page, call:

var
svgNode = BARCode('Hello World!');

Playground

svg barcode sample1svg barcode sample2

BARCode({

     msg  : '128 Code'
    ,dim  : [ 286, 80 ]
    ,pad  : [  20, 16 ] /* sample 1: normal orientation */ 

});

BARCode({

     msg  : '128 Code'
    ,dim  : [ 286, 80 ]
    ,pad  : [ 266, 16 ] /* sample 2: vertical flip */ 

});

svg barcode sample3svg barcode sample4

BARCode({

     msg  : 'vertical'
    ,dim  : [ 80, 286 ]
    ,pad  : [ 16,  20 ] /* sample 3: vertical orientation */ 

});

BARCode({

     msg  : 'vertical'
    ,dim  : [ 80, 286 ]
    ,pad  : [ 16, 266 ] /* sample 4: horizontal flip */ 

});

All available options:

BARCode({

     msg  :  message
    ,dim  : [ width, height ]
    ,pad  : [ padding-x, padding-y ]
    ,pal  : [ color, background-color ]

});

If something is lost or wrong it will fall back to default values and warn you in console, the picture will turn red:

if something goes wrong...

Options