JsBarcode icon indicating copy to clipboard operation
JsBarcode copied to clipboard

Measurement Units for Width and Height

Open Korak-997 opened this issue 3 years ago • 3 comments

I am working on a project which the width and height of should be really specific. With that i am not sure on which value should i set the width and height because i do not know what units of measurement they are using. for example if i put the width of 100 . What is the unit of that 100 ? Like is it : 100px, 100mm or which unit ?

I tried to find the answer in the documentations , but was not available ! Wish i can get the answer here :)

Thanks,

Korak-997 avatar May 21 '21 09:05 Korak-997

width is for a line. https://github.com/lindell/JsBarcode/wiki/Options#width

erados avatar Sep 14 '21 09:09 erados

I would like to know as well:)

awariat avatar May 01 '23 10:05 awariat

It seems this is the code for drawing a barcode.

https://github.com/lindell/JsBarcode/blob/19cdeea9a03c3cd863a74d074ed8f7d66825b718/bin/renderers/canvas.js#L91-L99

And this is the usage of fillRect for Canvas. here

fillRect(x, y, width, height)

And is says that default unit is px. here.

By default, one unit on the canvas is exactly one pixel.

So, it must be px.

erados avatar May 07 '23 12:05 erados