lindell / lindell/JsBarcode

jsBarcode doesn't update when trying to creat multiple barcodes with multiple canvases

Open
#363 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am trying to create multiple barcodes to later print in multiple pages. My issue is that when looking on an array of data to put in the barcode, I found out that the barcodes don't change after the first one, so creating 50 barcodes from 50 different data strings, would result in 50 identical barcodes as the first one.

my code is something like this :

```
await Promise.all(dataArray.map(stringData => {
const canvas = createCanvas();
JsBarcode(canvas, stringData, {
displayValue: false,
width: 1,
});
codes.push(canvas.toDataURL());
}))
```

the codes generated are all the same

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 reported Promise.all example with multiple canvas elements and different data strings, starting at the JsBarcode canvas entry point. Check why later renders produce identical data URLs; done means each canvas encodes its own input, with a regression test covering multiple canvases.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.