JsBarcode is a simple way to create different types of 1d barcodes.
The plugin uses Html5Canvas to generate draw the barcodes
- CODE128 (B or C)
- EAN (13 and 8)
- UPC-A
- CODE39
- ITF (Interleaved 2 of 5)
- ITF14
- Pharmacode
<img id="barcode">$("#barcode").JsBarcode("9780199532179",{format:"EAN", displayValue:true, fontSize:20});$("#barcode").JsBarcode("Hi!");JsBarcode("#barcode","JsBarcode is easy!",{width:1,height:25});Download and include the comined script that contain everything you need.
<script src="JsBarcode.all.min.js"></script>
As well as downloading the files and including them regularly, you can use Bower to install and manage the library
bower install jsbarcode --save
With jQuery:
$(object).JsBarcode(string,options);Or pure JavaScript:
JsBarcode(object, string, options);- string is the sring to be encoded to the barcode
- options is additional options put i an object (look below)
{
width: 2,
height: 100,
quite: 10,
format: "CODE128",
displayValue: false,
fontOptions: "",
font:"monospace",
textAlign:"center",
fontSize: 12,
backgroundColor:"",
lineColor:"#000"
}Use the closure compiler with this input
// ==ClosureCompiler==
// @output_file_name JsBarcode.all.min.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/CODE128.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/CODE39.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/EAN_UPC.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/ITF.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/ITF14.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/pharmacode.js
// @code_url https://raw.github.com/lindell/JsBarcode/master/JsBarcode.js
// ==/ClosureCompiler==


