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, 1:12 AM EDT
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, 2:42 AM EDT
Hi Krishna can this library be used to scan QR code from the webcam?
Sheetal GargPosted Aug 5, 2019, 9:28 PM EDT
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, 2:19 AM EDT
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, 2:20 AM EST
The demo code is not working for me.
siva sankarPosted Dec 21, 2017, 3:17 AM EST
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, 2:02 AM EST
Great .Thats what i was looking for.
Aquib ChiniwalaPosted Feb 5, 2017, 5:47 AM EST
How to call this method while scanning barcode through barcode scanner
Gonzalo RanalliPosted Oct 4, 2016, 4:46 AM EDT
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 7, 2016, 9:22 PM EDT
Nice...
GokulPosted Jun 5, 2016, 8:55 PM EDT
Nice bro
Gowtham RajamanickamTOP 100Posted Apr 2, 2016, 1:26 AM EDT
Good one...
Pavan TakorePosted Nov 26, 2015, 2:26 AM EST
Hi Sir, this dll is free? or we need to purchase.
Tanmay NehetePosted Oct 6, 2015, 8:14 PM EDT
its very helpful
Abhishek ChadhaPosted Jul 21, 2015, 9:42 PM EDT
is there any namespace for barcodescanner ???
Romeo MactalPosted May 22, 2014, 7:51 PM EDT
onbarcode is not free right?
MILEN MPosted Mar 27, 2014, 8:08 AM EDT
Another very good component for barcode reading: http://www.ibscanner.com/barcode-scanner-for-dot-net
lavanya geethaPosted Dec 17, 2012, 4:09 AM EST
Hi Sir , it is not compatible for windows phone 8 , please kindly help me...
mb mbPosted Jun 7, 2012, 12:12 AM EDT
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 8, 2012, 9:22 PM EDT
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, 4:31 PM EDT
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.