Free C# sample code below can be used to read and decode Code 93 bar codes from an image file on your local disk. Currently, raster images in Png, Bmp, Gif, Tiff, and Jpeg can be loaded into your Visual Studio C# project, in the form of bitmap, stream or string. Please see detailed APIs and demo code as below.
public void ScanCode93FromFile(string filename) { // Recognize Code 93 from a local image file in C# project. BarcodeResult[] results = BarCodeScanner.Scan(filename, BarCodeType.Code93); // Recognize Code 93 from a Bitmap or Stream of image in C# project. // public static BarcodeResult[] Scan(Bitmap bitmap, BarCodeType barType); // public static BarcodeResult[] Scan(Stream stream, BarCodeType barType); foreach (BarcodeResult result in results) { Console.WriteLine(result.BarType.ToString() + "-" + result.Data); } }
Moreover, we provide the way to read and decode single Code 93 barcode from image in C# project. It can help to improve the accuracy of barcode reading when you image has only one barcode.
Bitmap bmp = new Bitmap("YourImagePath"); BarcodeResult barcode = BarCodeScanner.ScanSingle(bmp); Console.WriteLine("barcode data:{0}.", barcode.Data);
If you want to read Code 93 barcode symbol from PDF document, you are supposed to convert PDF document to image(s) and then read Code 93 from the rendered image(s). Here, we provide a PDF to image conversion solution. Please see details here: .NET PDF to Image Conversion Guide.