lindell / lindell/JsBarcode

margin take in account only the first time

Open
#326 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
JavaScript
Stars
5.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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
```html


TAG {{ product.tagNumber }}


PNR {{ product.material.uid }}


SER {{ product.serialNumber }}




```

```javascript
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...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the three JsBarcode(...).CODE128(...).render() calls shown, with margin: 0 on each barcode. Inspect how the margin option is retained between successive renders; done means all three generated barcodes have no margin, regardless of call order.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.