This is my unique html code
<div class="pr-2" style="width: 130px">
<div *ngIf="!element.editing" >
<span class="ss">{{element.barcode}}</span>
</div>
<div *ngIf="element.editing" >
<input type="text" [(ngModel)]="element.barcode" style="width: 130px"/>
</div>
</div>
This is my custom css
.ss {
font-family: 'Libre Barcode 128 Text', cursive;
font-size: 22px;
}
Here's a javascript function I created for barcode generation:
barcodeGenerator(value){
let x = value
let i, j, intWeight, intLength, intWtProd = 0, arrayData = [];
let arraySubst = [ "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê" ];
/*
* Checksum Calculation for Code 128 B
*/
intLength = x.length;
arrayData[0] = 104; // Assume Code 128B, Will revise to support A, C and switching.
intWtProd = 104;
for (j = 0; j < intLength; j += 1) {
arrayData[j + 1] = x.charCodeAt(j) - 32; // Have to convert to Code 128 encoding
intWeight = j + 1; // to generate the checksum
intWtProd += intWeight * arrayData[j + 1]; // Just a weighted sum
}
arrayData[j + 1] = intWtProd % 103; // Modulo 103 on weighted sum
arrayData[j + 2] = 106; // Code 128 Stop character
const chr = parseInt(arrayData[j + 1], 10); // Gotta convert from character to a number
if (chr > 94) {
var chrString = arraySubst[chr - 95];
} else {
chrString = String.fromCharCode(chr + 32);
}
// document.getElementById(id).innerHTML =
return 'Ì' + // Start Code B
x + // The originally typed string
chrString + // The generated checksum
'Î'; // Stop Code
// return `<span class="ss">${x}</span>`;
}
This is the Output enter image description here
However, I am looking to hide or remove some text beneath the barcode like shown in this example enter image description here