0

I developing a web application. Can i enable it to read barcodes using barcode reader with ASP.Net MVC 5. What sort of API or Library i should use?

I want to read barcodes in my web application using a barcode reader

Burhan uddin
  • 21
  • 1
  • 6
  • 2
    This is not a question, its a statement of intent and a plea for information. neither of which is what stackoverflow is about, please read this... [ask] – TheGeneral May 13 '19 at 08:41

2 Answers2

0

you have to read the event through Javascript. (In browser, on key press) Best option for you is HID scanner. it works like a keyboard

scanner would enter characters faster. you can use this link for example. Detect when input box filled by keyboard and when by barcode scanner.

or you can add a prefix to your barcode and onkeypress you can see which combination is entered.

zetawars
  • 1,023
  • 1
  • 12
  • 27
0

The first thing you need to is to prevent postback when item barcode is scanned. It is because the barcode scanner will send an enter key after item is scanned. You need to create a script to convert enter key to tab

$(document).ready(function () {
        var self = $(this)
       , form = self.parents('form:eq(0)')
       , focusable
       , next
        ;
        if (e.keyCode == 13) {
            focusable = form.find('input,a,select,button,textarea').filter(':visible');
            next = focusable.eq(focusable.index(this) + 1);
            if (next.length) {
                next.focus();
            } else {
                form.submit();
            }
            return false;
        }
});

After that, you may scan the barcode wherever you like. API is not needed for barcode. it works like a keyboard except that it converts barcode to readable text.

Yat Fei Leong
  • 751
  • 1
  • 6
  • 10