C#: Online Guide
How To: Barcode Reader
Code 93
Code 93
  |  
Home ›› XImage.Barcode Reader ›› C# Barcode Reader: Code 93

C# Imaging - Decode Code 93 Barcode in C#.NET


C# Code to Scan Code 93 Barcode from Image and Document




Code 93 Reading Control in C#.NET



RasterEdge is committed to supporting and developing .NET imaging solutions that can be used to automate document management and image processing applications. The barcode reader control from RasterEdge DocImage SDK for .NET utilizes the most advanced 1D and 2D barcodes scanning methods. Using RasterEdge .NET Imaging Barcode Reader control, you can easily read & decode linear Code 93 barcode from image files (PNG, TIFF, GIF, JPEG & BMP) and documents (PDF, multi-page TIFF, Excel, PowerPoint & Word).


Related .net document control helps:
asp.net edit pdf image: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net iis document viewer: C# HTML5 Viewer: Deployment on IIS
asp.net pdf file permission: ASP.NET PDF File Permission Control: apply, remove PDF file permission settings in C#
asp.net excel document viewer: ASP.NET Excel Document Viewer in C# Control: view office excel files online in ASP.NET web applications
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net dnn document viewer: DNN Document Viewer Control: view, annotate, redact, convert documents in dotnetnuke ASP.NET


Code 93, also known as ANSI/AIM Code 93, ANSI/AIM Code 93, Uniform Symbology Specification Code 93, is an alphanumeric, variable-length linear barcode symbology. It came into being with the purpose to provide a higher density and data security enhancement to Code 39. In the daily applications, this 1d Code 93 barcode is primarily used to encode supplementary delivery information by Canada Post.




C# Imaging Code 93 Recognition Features



A compact library with mature & advanced Code 93 barcode reading functions for C#.NET


Written in managed C# code and designed specifically for .NET framework applications


Easy to use, decode & read all Code 93 barcodes from source file using few lines of C# code


Recognize Code 93 barcode from raster image files without using other component in C#.NET


Detect & recognize Code 93 barcode from common document files like PDF, Excel, PowerPoint & Word


Extract Code 93 barcode value from document image files as data string using C# code


Detect & scan Code 93 barcode from target file at any angles in C#.NET imaging applications




Steps to Read/Scan Data Matrix from Image/PDF/TIFF/Office File



Load an image or a document(PDF, TIFF, Word, Excel, PowerPoint).


Get a Bitmap or BasePage used to decode or read barcode.


Set the barcode reader settings.


Call the following static method in BarcodeReader.cs to read or scan barcode from Bitmap or BasePage.


  public static Barcode[] ReadBarcodes(ReaderSettings settings, BasePage page)


  public static Barcode[] ReadBarcodes(ReaderSettings settings, Bitmap image)


The barcode information will be saved in the array of Barcode object. While, if you read barcodes information from the BasePage failed, you can try as follows:


  Convert BasePage to Bitmap with higher resolution by Calling method ConvertToImage(int resolution) in the BasePage.cs:



            //Convert page to bitmap.
            //The default resolution is 96, if youo set the resolution higher, it will be better to read or scan barcode.
            Bitmap bmp = page.ConvertToImage(192);

            //  read all barcodes in the page
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(settings, bmp);

            foreach (Barcode barcode in barcodes)
            {
                Console.WriteLine("Data: " + barcode.DataString);
            }



If you want to have a try, please refer to the following demo codes.


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.




Decode Code 93 from Image in C#.NET



Our Code 93 image barcode reading library control toolkit empowers C#.NET developers and users across your organization with the ability to read & decode Code 93 barcode from JPEG, GIF, PNG and BMP image file formats using simple C# code. The scanned image file can be from your local file or be loaded from a web application using our RasterEdge DocImage SDK for .NET.


Add necessary references to your C#.NET project. Right-click the project and select "Add Reference..." to locate and add the following DLLs as project references;


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XImage.BarcodeScanner.dll


Use corresponding namespaces;


  using RasterEdge.XImage.BarcodeScanner;




            Bitmap bmp = new Bitmap(inputDirectory + "Sample_Barcode.png");
            //  config reader setting
            ReaderSettings settings = new ReaderSettings();
            //  define the type of barcode to scan
            settings.AddTypesToRead(BarcodeType.Code93);

            //  read all barcodes in the document
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(settings, bmp);

            foreach (Barcode barcode in barcodes)
            {
                Console.WriteLine("Data: " + barcode.DataString);
            }





C#: DLLs for Code 93 Barcode Scanning from Document(TIFF, PDF, Office)



In order to run the following demo codes reading Code 93 from document, the steps as follows are necessary.


Add references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.XImage.BarcodeScanner.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.XImage.BarcodeScanner;


  using RasterEdge.Imaging.Basic;




Decode Code 93 from TIFF Image File in C#.NET



The demo C# code below will help you detect & decode all Code 93 barcodes from sample  tiff image files and return values of all recognized Code 93 barcodes to data strings.


Add references(Extra):


  RasterEdge.XDoc.TIFF.dll


Use corresponding namespaces(Extra):


  using RasterEdge.XDoc.TIFF;




            // load TIFF document
            TIFFDocument doc = new TIFFDocument(inputDirectory + "Sample_Barcode.tif");

            // get the page you want to scan
            BasePage page = doc.GetPage(0);

            // set reader setting
            ReaderSettings setting = new ReaderSettings();

            // set type to read
            setting.AddTypesToRead(BarcodeType.Code93);

            // read barcode from tiff page
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);

            foreach (Barcode barcode in barcodes)
            {
                // print the loaction of barcode on image
                Console.WriteLine(barcode.BoundingRectangle.X + "  " + barcode.BoundingRectangle.Y);

                // output barcode data onto screen 
                Console.WriteLine(barcode.DataString);
            }





Decode Code 93 on PDF in C#.NET Project



As for the Code 93 barcode scanning & recognition from PDF document, our RasterEdge DocImage SDK for .NET will convert a PDF page into a raster image automatically. Then this C#.NET barcode reader & decoder control will conduct its fast, accurate & mature Code 93 barcode detecting & scanning functions in this rasterized image file.


Add references(Extra):


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces(Extra):


  using RasterEdge.XDoc.PDF;




            // load PDF document
            PDFDocument doc = new PDFDocument(inputDirectory + "Sample_Barcode.pdf");

            // get the page you want to scan
            BasePage page = doc.GetPage(0);

            // set reader setting
            ReaderSettings setting = new ReaderSettings();

            // set type to read
            setting.AddTypesToRead(BarcodeType.Code93);

            // read barcode from PDF page
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);

            foreach (Barcode barcode in barcodes)
            {
                // print the loaction of barcode on image
                Console.WriteLine(barcode.BoundingRectangle.X + "  " + barcode.BoundingRectangle.Y);

                // output barcode data onto screen 
                Console.WriteLine(barcode.DataString);
            }





Decode Code 93 on Word in C#.NET Project



The Code 93 barcode detecting & reading also starts with a Word page's rasterization. Then you can define an area in the rasterized image file for the barcode reader control to detect and read Code 93 barcodes. By default, the barcode reader control will scan the whole image to decode Code 93 barcode.


Add references(Extra):


  RasterEdge.XDoc.Word.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


Use corresponding namespaces(Extra):


  using RasterEdge.XDoc.Word;




            // load Word document
            DOCXDocument doc = new DOCXDocument(inputDirectory + "Sample_Barcode.docx");

            // get the page you want to scan
            BasePage page = doc.GetPage(0);

            // set reader setting
            ReaderSettings setting = new ReaderSettings();

            // set type to read
            setting.AddTypesToRead(BarcodeType.Code93);

            // read barcode from Word page
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);

            foreach (Barcode barcode in barcodes)
            {
                // print the loaction of barcode on image
                Console.WriteLine(barcode.BoundingRectangle.X + "  " + barcode.BoundingRectangle.Y);

                // output barcode data onto screen 
                Console.WriteLine(barcode.DataString);
            }





Read Code 93 Barcode from Excel Sheet



Users can read all Code 93 barcode images from defined Excel sheet and return the values of decoded Code 93 barcode images into data string using this C# Code 93 barcode scanning control.


Add references(Extra):


  RasterEdge.XDoc.Excel.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


Use corresponding namespaces(Extra):


  using RasterEdge.XDoc.Excel;




            // load Excel document
            XLSXDocument doc = new XLSXDocument(inputDirectory + "Sample_Barcode.xlsx");

            // get the page you want to scan
            BasePage page = doc.GetPage(0);

            // set reader setting
            ReaderSettings setting = new ReaderSettings();

            // set type to read
            setting.AddTypesToRead(BarcodeType.Code93);

            // read barcode from Excel page
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);

            foreach (Barcode barcode in barcodes)
            {
                // print the loaction of barcode on image
                Console.WriteLine(barcode.BoundingRectangle.X + "  " + barcode.BoundingRectangle.Y);

                // output barcode data onto screen 
                Console.WriteLine(barcode.DataString);
            }





Scan Code 93 Barcode from PowerPoint Slide



This C# Code 93 barcode reader SDK allows developers to scan Code 93 barcode from whole PowerPoint slide or certain defined PowerPoint area. Following sample C# code is used to scan Code 93 barcode(s) from whole PowerPoint slide.


Add references(Extra):


  RasterEdge.XDoc.PowerPoint.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


Use corresponding namespaces(Extra):


  using RasterEdge.XDoc.PowerPoint;




            // load PowerPoint document
            PPTXDocument doc = new PPTXDocument(inputDirectory + "Sample_Barcode.pptx");

            // get the page you want to scan
            BasePage page = doc.GetPage(0);

            // set reader setting
            ReaderSettings setting = new ReaderSettings();

            // set type to read
            setting.AddTypesToRead(BarcodeType.Code93);

            // read barcode from PowerPoint page
            Barcode[] barcodes = BarcodeReader.ReadBarcodes(setting, page);

            foreach (Barcode barcode in barcodes)
            {
                // print the loaction of barcode on image
                Console.WriteLine(barcode.BoundingRectangle.X + "  " + barcode.BoundingRectangle.Y);

                // output barcode data onto screen 
                Console.WriteLine(barcode.DataString);
            }