JsBarcode icon indicating copy to clipboard operation
JsBarcode copied to clipboard

Creating a List of barcodes

Open munyite-megzs opened this issue 6 years ago • 1 comments

When I loop through the number of barcodes that I need to generate, I get that the barcode will print the number of those barcodes but the the text remains the same. I also need to change the text. e.g.

for (var i = 0; i < copies; i++) { let finalCode = ""; const codeNumeber = i + 1; finalCode = code.concat(codeNumeber);

                console.log(finalCode);
                 var line = document.createElement("img");
                line.setAttribute("id", "barcode");
                document.getElementById("barcodeClass").appendChild(line);
                JsBarcode("#barcode", finalCode, {
                    fontOptions: "bold",
                    width: 1
                }); 

            }  

will print image

munyite-megzs avatar Oct 22 '19 15:10 munyite-megzs

What i did was line.setAttribute("id", "a"+i); and JsBarcode("#a"+i, .....) which worked !

willos2006 avatar Apr 12 '20 11:04 willos2006