joushx/jQuery.EAN13

Adding padding destroys the generated barcode

Closed this issue · 4 comments

Adding padding destroys the generated barcode.
I'm using Firefox Developer Edition 44.0a2 (2015-12-13)

Code

<canvas id="ean" width="220" height="120"></canvas>
jQuery('#ean').EAN13('1230000000338', {
    number: true,
    prefix: false,
    background: '#ffffff',
    padding: '10'
});

Output

ean

Output without padding

ean2

Please have a look at the readme file. The padding option needs an integer.

jQuery('#ean').EAN13('1230000000338', {
    number: true,
    prefix: false,
    background: '#ffffff',
    padding: 10
});

oh, sry again. 😢 Maybe adding a parseInt(padding, 10) to avoid such misreadings?

In my opinion the user has to make sure the parameters are correct. It would blow up the code to check for all possible wrong use cases.

k, sry again