JsBarcode
JsBarcode copied to clipboard
margin take in account only the first time
Hi,
I'm stuck with a weird problem... I think it's a bug of the library.
I'm using jsBarcode to generate product labels
<div id="productLabel" >
<p>TAG {{ product.tagNumber }}</p>
<img id="barcode1" />
<p>PNR {{ product.material.uid }}</p>
<img id="barcode2" />
<p>SER {{ product.serialNumber }}</p>
<img id="barcode3" />
</div>
JsBarcode(document.getElementById("barcode1"))
.CODE128(`*RPO ${product.uid}*`, { height: 50, displayValue: false, margin: 0 })
.render();
JsBarcode(document.getElementById("barcode2"))
.CODE128(`*PNR ${product.material.uid}*`, { height: 50, displayValue: false, margin: 0 })
.render();
JsBarcode(document.getElementById("barcode3"))
.CODE128(`*SER ${product.serialNumber}*`, { height: 50, displayValue: false, margin: 0 })
.render();
Only the first generated barcode will have no margin Other barcode will have default margin (10px)
If I switch the order, by example i generate the #barcode2 before the #barcode1, the #barcode2 will have no margin, and the 1 and 3 will have default margin...
This does indeed seem to be a bug. Will look into it. https://jsfiddle.net/6b5j78va/1/