lindell / JsBarcode

Barcode generation library written in JavaScript that works in both the browser and on Node.js
http://lindell.me/JsBarcode
MIT License
5.5k stars 1.11k forks source link

I can't get the scan result when i scan the barcode generated by jsbarcode in js #170

Closed kicke0609 closed 7 years ago

kicke0609 commented 7 years ago

code like this: JsBarcode("#barcode", data.receipt_info.order_number, {format:"CODE128",width:1.5,height:40,displayValue:true,fontOptions:"bold",margin:1});

Q1: I can't get the scan result when i scan the barcode generated by jsbarcode in js.barcode is printed in a zebra/barcode printer,But,when i print the barcode on a general printer using A4 page, i can scan and get right result.

Q2: Changing CODE128 TO CODE39/EAN13, it does't work!

lindell commented 7 years ago

Q1: You should not use non-integer widths when using barcodes on screens. There is no such thing as half pixels! (If you are not using a retina screen).

Q2: What is data.receipt_info.order_number? EAN13 for example, can only encode international article numbers which are 12 digits + an error digit

lindell commented 7 years ago

Did I answer your question? Can this issue be closed?

hpabubacar commented 7 years ago

doesnt work on my code either.

my code for the display is svg. and jscript code is like this: <script> $(document).ready(function(){ $("#gen").click(function(){ JsBarcode("#barcode", $('#barc').val()) }); $("#gen").click(function(){ $("#printu").show(); }); }); $(document).keypress(function(e){ if(e.which == 13){ JsBarcode("#barcode", $('#barc').val(), {format: "EAN13"}); } }); </script>

barcode is for the svg and the barc.val() is for the input field's content.

i've tried a scanner app and the barcode could be scanned perfectly on the computer screen, but when printed, the scanner app and the barcode reader itself cannot read the barcode..

does it have anything to do with the size of the printout?

lindell commented 7 years ago

does it have anything to do with the size of the printout?

Yes. Or there might be some setting for the printing you can change.

lindell commented 7 years ago

@kicke0609 Closing this issue since I got no answers.