Introduction
Background:
In some cases, the developer needs to
generate the barcode images and scan those barcode images. You can check how to
generating barcode images
and scanning those barcode images from our C# application. We will see how to
perform the scanning task in this article step-by-step.
Step 1:
Download barcode reader dll from here and add the reference to Onbarcode.Barcode.BarcodeScanner to your application.
Download barcode reader dll from here and add the reference to Onbarcode.Barcode.BarcodeScanner to your application.
Step 2:
This BarcodeScanner dll contain so many methods to scan the barcode image and retrive the data present in those images. Write this two methods to scan the barcode images.
This BarcodeScanner dll contain so many methods to scan the barcode image and retrive the data present in those images. Write this two methods to scan the barcode images.
1)
ReadBarcodeFromFile:
This
method is very simple method to scan the barcode image which will take the
filenpath as argument where barcode image is present and retrive String[] as
data.
- private String[] ReadBarcodeFromFile(string _Filepath) {
- String[] barcodes = BarcodeScanner.Scan(_Filepath, BarcodeType.Code39);
- return barcodes;
- }
2)
Read BarcodeFromBitmap:
This one other method is provided by
BarcodeScanner dll which will take Bitmap image as input and returns same
String[] as output.
- private String[] ReadBarcodeFromBitmap(Bitmap _bimapimage) {
- System.Drawing.Bitmap objImage = _bimapimage;
- String[] barcodes = BarcodeScanner.Scan(objImage, BarcodeType.Code39);
- return barcodes;
- }
You can
call this method by passing barcode image as bitmap.

Abhay KumarPosted May 9, 2023, 5:12 AM
Private string ScanBarcode() { //return "1234567890"; BarcodeScanner scanner = new BarcodeScanner(); // create a new instance of the barcode scanner scanner.Connect(); string barcode = scanner.Scan(); // read the barcode from the scanner scanner.Disconnect(); return barcode; } I am facing error on BarcodeScanner option. even if library is there. what will be the solution
Neelesh RawalPosted May 26, 2020, 6:42 AM
Hi Krishna can this library be used to scan QR code from the webcam?
Sheetal GargPosted Aug 6, 2019, 1:28 AM
I am Not getting this Onbarcode.Barcode.BarcodeScanner dll in nuget in visual studio Onbarcode.Barcode.BarcodeScanner.is there any other option available here
bhavani sivaPosted Apr 26, 2019, 6:19 AM
Hi, I have a requirement like read the barcode from the pdf file. your solution is not working for me can you please suggest me to get the exact output of the barcode from the pdf file. in the pdf file, the barcode may reverse order also I need to get that barcode value
Swati JainPosted Dec 31, 2017, 7:20 AM
The demo code is not working for me.
siva sankarPosted Dec 21, 2017, 8:17 AM
The first character of barcode data scanned by the trial package will be a random character. http://www.barcodelib.com/net_barcode_reader/main.html
Sagar Pandurang KapPosted Dec 13, 2017, 7:02 AM
Great .Thats what i was looking for.
Aquib ChiniwalaPosted Feb 5, 2017, 10:47 AM
How to call this method while scanning barcode through barcode scanner
Gonzalo RanalliPosted Oct 4, 2016, 8:46 AM
Hi Krishna, first thank you for your excellent article. This dll is the best i have found. I need to contact you, i added the dll on my aplication and it read all my barcodes but in some reads it changed my first char. If you don't have problem i would like to send you that images and i wanna hear if you have any solution or if you know any new dll. Thank you so much!
kalu singh raoPosted Jul 8, 2016, 1:22 AM
Nice...
GokulPosted Jun 6, 2016, 12:55 AM
Nice bro
Gowtham RajamanickamPosted Apr 2, 2016, 5:26 AM
Good one...
Pavan TakorePosted Nov 26, 2015, 7:26 AM
Hi Sir, this dll is free? or we need to purchase.
Tanmay NehetePosted Oct 7, 2015, 12:14 AM
its very helpful
Abhishek ChadhaPosted Jul 22, 2015, 1:42 AM
is there any namespace for barcodescanner ???
Romeo MactalPosted May 22, 2014, 11:51 PM
onbarcode is not free right?
MILEN MPosted Mar 27, 2014, 12:08 PM
Another very good component for barcode reading: http://www.ibscanner.com/barcode-scanner-for-dot-net
lavanya geethaPosted Dec 17, 2012, 9:09 AM
Hi Sir , it is not compatible for windows phone 8 , please kindly help me...
mb mbPosted Jun 7, 2012, 4:12 AM
Hi Sir , ReadBarcodeFromFile(string _Filepath) I pass Image url to _filpath like this "~/upload/image/1.gif" and readbarcode return null. plz tell me how to pass image in order to get scan
Krishna GaradPosted May 9, 2012, 1:22 AM
you can try this one may work for windows phone http://www.codeproject.com/Articles/42852/Reading-Barcodes-from-an-Image-III
Arun Kumar GKPosted May 8, 2012, 8:31 PM
Hi Sir The dLL Onbarcode.Barcode.BarcodeScanner is applicable to only desktop Applications.but I am developing windows phone 7 Application.so if i add reference it shows only windows phone 7 assemblies can add.can u help me. I am waiting for your Assemblies.