samt/barcode

Error: Width will result in a degenerate barcode

Karabi-Choudhury opened this issue · 4 comments

I have generated a barcode of dimensions width: 200, height: 50. But i am getting an error
"Error: Width will result in a degenerate barcode".
Can we generate a barcode of this dimension?

samt commented

This means that the data you're trying to put in that barcode will not fit in 200px. You need to increase the pixel width or decrease the amount of data.

In my barcode i have data like "WBC2C2746012" and my dimensions are width: 150,height: 50.I am getting this error Can you provide any resolution

samt commented

You need to increase the width of the barcode. In this particular case, the smallest bar pattern (1px) will be indistinguishable from the next smallest, removing its ability to be read effectively by a barcode reader.

FYI - I saw this error when accidentally passing an integer to the data field. Converting it to a string fixed the issue: var codeAsString = ""+codeAsInteger;