Bar code reader and scanner integration

Please help me how to integrate barcode reader to ruby on rails
application?Please give me sample code


So what platform is this bar code reader supposed to run on?

It might have some bearing on the solution being offered you would think.

The more pertinent information you supply the greater the likelihood
of getting a useful reply.

Up to and including "you can't do it that way". It's shocking how many so-called web developers from the Windows side don't realize that in browsers on those other platforms you can't necessarily have arbitrary access to the file system and attached devices--and that this is considered a feature.

I won't do the work the original poster is asking us to do, but there is actually a way to use barcode scanners without having access to attached devices or the filesystem (and it will work on any browser for that matter).

Most barcode scanners support emulating keyboard presses (and send them as if someone would actually type out the number the barcode represents). Some of them even allow you to set a leading character (just some control code) and to end the barcode with some keypress (like ENTER or Return or even a custom random keystroke). You'll have to do your own research to find which ones you can buy where you live and which ones support this feature. On a side node, most local barcode scanner suppliers will be happy to send you a test device if you ask them nicely.

Given that the barcode scanner allows for a leading and a trailing keypress, all that would be required is that the browser window that allows scanning the barcode is the frontmost and active window at all times. Then it's just a matter of writing some javascript code that listens for the keyup event, if the leading control code is sent you start capturing whatever comes next into a javascript variable until it hits the trailing control code, then send that off to the server for processing.
If the barcode scanner doesn't allow a leading character, you can just make sure that webpage is just accepting barcode input.

This is as far as I can and will take you. You basically have all the pieces of the puzzle, now it's up to you to find the right device, write the necessary code to capture the device output and make it work with your app. That's part of being a developer: solve problems and come up with a good solution and then actually write the code for it.

Best regards

Peter De Berdt

1 Like

@Peter - so true - have an application running for 2+ yrs with barcode support (label and scanners)

scanners: like Peter described, emulating keypress
label: using Flying Saucers xhtmlrenderer java project to render PDF's with barcodes


there are many ways to do that. If you wanna save these complicated
steps and find a easy way, you can google barcode scanner and you will
find many useful tools, or google how to read barcode in c# to get
instructive articles. Good luck:) I think some imaging sdk programmes
can enable to quickly scan barcodes. i have use imaging sdkr which can
original layouts hyperlinks, Images and tables retained in word ,text,
image, Epub, html.but i forgot download the wedsite ,go to google. By
the way , pay attention to your system platform, select the suitable one
. I use a barcode scanner driver found on the internet . Install it and
it becomes a selectable option.Then you can scan barcodes in many
formats in any program at all, including Adobe Acrobat . Just open the
sdk, select barcode, and choice a form you want, then you can scan
barcode in c#, vb, sdp ,etc ,the task will be finished in several
seconds. if you haven't found a good choice , you can have a try. best

I think you really need to make full use of Google. When you just put “barcode reader” in google, you can find various barcode readers, like QR Code reader, Code 39 reader, etc. I believe you can find what you want soon. Nowadays reading barcode is very easy with a barcode reader. You just install it in your program and do a few steps and the work is done.

thanx for you guys sharing! more information about barcode reader or
scanner ,you may tr to search on google,and i found another one

Integrating a barcode reader within a imaging application is no
more a problem. Such image barcode reading toolkit of web
project can be used to detect and decode any linear or 2d barcode from
image or document page.

Google the question and found following thread on the same barcode scanning issue.