JsBarcode is a simple way to create different types of 1d barcodes.
The plugin uses Html5Canvas to generate draw the barcodes
- CODE128 (B)
- EAN (13)
- UPC-A
- CODE39
- ITF14
####A Html5Canvas barcode generator is included to draw the barcodes.
$(object).JsBarcode(string,options);
####Where:
- string is the sring to be encoded to the barcode
- options is additional options put in an object (look below)
####The default options:
{
displayValue: true, //True to display the encoded string; false to hide; other values get printed
fontFace: 'arial', //Font face to use for the display value
fontSize: 12, //Font size to use for the display value
width: 2, //Width of barcode lines
height: 100, //Height of barcode
quiet: 10, //Barcode quiet zone
format: "CODE128" //Barcode format
returnUri: false //If true, return URI value vs setting uri on passed in image
}
####First we need an image
<img id="barcode">
$("#barcode").JsBarcode("Hi!");
$("#barcode").JsBarcode("Javascript is fun!",{width:1,height:25});
$("#barcode").JsBarcode("9780199532179",{format:"EAN"});
setInterval(function(){
var date = new Date();
$("#barcode").JsBarcode(date.getHours()+":"+date.getMinutes()+":"+date.getSeconds());
},1000);
Use the closure compiler with this input
// ==ClosureCompiler==
// @output_file_name JsBarcode.all.min.js
// @code_url https://raw.github.com/hospitalrun/JsBarcode/master/CODE39.js
// @code_url https://raw.github.com/hospitalrun/JsBarcode/master/CODE128.js
// @code_url https://raw.github.com/hospitalrun/JsBarcode/master/EAN_UPC.js
// @code_url https://raw.github.com/hospitalrun/JsBarcode/master/ITF14.js
// @code_url https://raw.github.com/hospitalrun/JsBarcode/master/JsBarcode.js
// ==/ClosureCompiler==