text: exports.binaryRepresentationForBarcodeData = function(barcodeData) {
    var digits = {
  	0: "00110",
  	1: "10001",
  	2: "01001",
  	3: "11000",
  	4: "00101",
  	5: "10100",
  	6: "01100",
  	7: "00011",
  	8: "10010",
  	9: "01010"
    };
  
    if (barcodeData.length % 2 != 0) {
  	barcodeData = "0" + barcodeData;
    }
  
    var binaryDigits = "0000";
    // Start of barcode
    for (var i = 0; i < barcodeData.length; i += 2) {
  	var digit1 = digits[parseInt(barcodeData[i])];
  	var digit2 = digits[parseInt(barcodeData[i + 1])];
  
  	for (var j = 0; j < digit1.length; j++) {
  	  binaryDigits += digit1[j] + digit2[j];
  	}
    }
  
    // End of barcode
    binaryDigits += "1000";
  
    return binaryDigits;
  }
  
  // Convert a value to a little endian hexadecimal value
  exports._getLittleEndianHex = function(value) {
    var result = [];
  
    for (var bytes = 4; bytes > 0; bytes--) {
  	result.push(String.fromCharCode(value & 0xff));
  	value >>= 0x8;
    }
  
    return result.join('');
  }
  
  exports._bmpHeader = function(width, height) {
    var numFileBytes = exports._getLittleEndianHex(width * height);
    width = exports._getLittleEndianHex(width);
    height = exports._getLittleEndianHex(height);
    
    return 'BM' + // Signature
  	numFileBytes + // size of the file (bytes)*
  	'\x00\x00' + // reserved
  	'\x00\x00' + // reserved
  	'\x36\x00\x00\x00' + // offset of where BMP data lives (54 bytes)
  	'\x28\x00\x00\x00' + // number of remaining bytes in header from here (40 bytes)
  	width + // the width of the bitmap in pixels*
  	height + // the height of the bitmap in pixels*
  	'\x01\x00' + // the number of color planes (1)
  	'\x20\x00' + // 32 bits / pixel
  	'\x00\x00\x00\x00' + // No compression (0)
  	'\x00\x00\x00\x00' + // size of the BMP data (bytes)*
  	'\x13\x0B\x00\x00' + // 2835 pixels/meter - horizontal resolution
  	'\x13\x0B\x00\x00' + // 2835 pixels/meter - the vertical resolution
  	'\x00\x00\x00\x00' + // Number of colors in the palette (keep 0 for 32-bit)
  	'\x00\x00\x00\x00'; // 0 important colors (means all colors are important)
  }
  
  exports.bmpLineForBarcodeData = function(barcodeData) {
    var binaryRepresentation = exports.binaryRepresentationForBarcodeData(barcodeData);
  
    var bmpData = new Array();
    var black = true;
    var offset = 0;
  
    for(var i = 0; i < binaryRepresentation.length; i++) {
  	var digit = binaryRepresentation[i];
  	var color = black ? String.fromCharCode(0, 0, 0, 0) : String.fromCharCode(255, 255, 255, 0);
  	var pixelsToDraw = (digit == "0") ? 1 : 3;
  
  	for(var j = 0; j < pixelsToDraw; j++) {
  	  bmpData[offset++] = color;
  	}
  
  	black = !black;
    }
  
    var bmpHeader = exports._bmpHeader(offset - 1, 1);
    var bmpBuffer = new Buffer(bmpHeader + bmpData.join(""), 'binary');
    return bmpBuffer.toString('base64');
  }
  