SVG Based Bar Code (Code-128 ) Generator – Barcode.js

Category: Javascript | March 16, 2020
Author:datalog
Views Total:2,344 views
Official Page:Go to website
Last Update:March 16, 2020
License:MIT

Preview:

SVG Based Bar Code (Code-128 ) Generator – Barcode.js

Description:

A simple, fast and customizable bar code generator that helps you generate Code-128 bar codes using SVG.

Looking for a bar code generator with HTML canvas? Check out the code128.js library.

How to use it:

1. Download and insert the Barcode.js library into the document.

<script src="barcode.min.js"></script>

2. Generate a basic SVG bar code.

var svgNode = new BARCode('CSSScript.Com');

3. You can create a vertical bar code by adjusting the width & height in the dim settings.

var svgNode = new BARCode('CSSScript.Com',{
    dim: [width, height]
});

4. Set the x/y paddings. If any padding value is greater than the relative dimension value then the barcode will be rotated by 180 degrees respectively.

var svgNode = new BARCode('CSSScript.Com',{
    pad: [padding-x, padding-y]
});

5. Set the path and background colors.

var svgNode = new BARCode('CSSScript.Com',{
    pal: [ color, background-color ]
});

You Might Be Interested In:


Leave a Reply