using IronBarCode;
using IronSoftware.Drawing;
using System.Drawing;
using System.IO;
// Reading a barcode is easy with IronBarcode.
// Read from a File, Bitmap, Image, or Stream:
var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file
var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap
var resultFromAnyBitmap = BarcodeReader.Read(new AnyBitmap("barcode.bmp")); // From an Anybitmap
var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image
var resultFromStream = BarcodeReader.Read(myStream); // From a stream
// PDFs are more intricate and must be read using ReadPdf:
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf");
Imports IronBarCode
Imports IronSoftware.Drawing
Imports System.Drawing
Imports System.IO
' Reading a barcode is easy with IronBarcode.
' Read from a File, Bitmap, Image, or Stream:
Private resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file
Private resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap
Private resultFromAnyBitmap = BarcodeReader.Read(New AnyBitmap("barcode.bmp")) ' From an Anybitmap
Private resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image
Private resultFromStream = BarcodeReader.Read(myStream) ' From a stream
' PDFs are more intricate and must be read using ReadPdf:
Private resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf")
Install-Package BarCode
Read Barcodes
We can read barcodes using the BarcodeReader class. The easiest method to use is the BarcodeReader.Read method, as shown above.
Do note all of the various options set in BarcodeReaderOptions that allow you to customise your reading to be faster, more intensive, stop scanning after reaching one barcode to save time, specify specific types of barcode to search for, and utilize multithreading, among other customization options.
Related Docs Links
Ready to get started? Version: 2024.10 just released