Open jaisal1024 opened 6 months ago
This works for me:
const bwipjs = require('bwip-js');
console.log(bwipjs.BWIPJS_VERSION); // 4.3.0 (2024-03-12)
(async function() {
let buf = await bwipjs.toBuffer({
bcid:'code128',
text: '5555563151499218',
includetext: true,
textxalign: 'center',
backgroundcolor: '#abcdef',
padding: 5,
});
require('fs').writeFileSync('bg.png', buf);
})();
I suspect you are using an out of date version.
When i call the toBuffer API like so:
The generated PNG is transparent, not white.
To fix it i have to call the API like so:
and it adds a white background. The
backgroundcolor: '#ffffff',
should either throw an error or work as its really confusing to figure out what is going on!