XImage.Barcode Reader
Features
Tech Specs
How-to C#
Pricing

C# Imaging - Scan Linear UPC-E in C#.NET


Decode UPC-E Barcode from Image and Document in C#.NET Project. Support Read barcode from PDF in C#.






C#.NET - UPC-E Scanning Overview



UPC-E is also known as Universal Product Code version E, UPC-E Supplement 5/Five-digit Add-On, UPC-E Supplement 2/Two-digit Add-On, is a compressed version of the UPC-A symbol and is generally used anywhere a UPC-A symbol will not fit. The compression algorithm removes unneeded zeros from the underlying data structure effectively converting 10 characters into 6.


Related .net document control helps:
asp.net pdf editor control: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net pdf viewer control: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net ppt viewer: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net edit pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net excel web viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#


RaterEdge .NET Imaging Barcode toolkit seamlessly adds linear 1D barcode creation, detection and decoding to RaterEdge .NET imaging SDKs. RaterEdge is the barcode reading and writing leader in industry providing high speed and very accurate barcode reader and creator for nearly 30 different barcode types and sub-types. RaterEdge .NET Imaging Barcode Add-on differs from other ordinary barcode creator on its comprehensive dll for creating and reading 1D and 2D barcodes on image and document in variable Visual .NET applications, including Windows Forms, ASP.NET applications with C#, VB.NET, vb6, Delphi, etc.


C#.NET UPC-E Barcode Reader within RaterEdge .NET Imaging Barcode toolkit can easily incorporate expert document and image processing capabilities into its application including: reading UPC-E barcode from images and reading UPC-E barcode from PDF & Word document pages. Users also can link to create UPC-E barcode by using C#.NET and VB.NET code to decode UPC-E barcode to get detailed guidance.




C#.NET - Benefits of UPC-E Reading



Easy to integrate into C#.NET application with only a few lines of code


Read UPC-E barcode from images and documents in C#.NET applications


Fast scan UPC-E barcode from GIF, BMP, PNG, TIFF or JPEG image


High quality of reading UPC-E barcode from PDF, Excel, PowerPoint & Word documents in C# class


Scan multiple barcodes and return the complete string values of all recognized UPC-E barcodes


Decode UPC-E supplement barcode symbol in C#.NET code


Read UPC-E barcode checksum digit automatically




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.




How to Decode UPC-E on Image in C#.NET



Completely developed in C#.NET, RasterEdge .NET Barcode Reader allows C# users to easily integrate UPC-E reading control into your created C#.NET project. Following C# sample code is for reading UPC-E barcode from PNG images. If you want to read UPC-E barcode from other images, like GIF, BMP, and JPEG, just change the image format setting.


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.UPCE);

            //  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 UPC-E Barcode Scanning from Document(TIFF, PDF, Office)



In order to run the following demo codes reading UPC-E 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;




Recognize UPC-E from TIFF Image in C#.NET



Following C# sample code allows users to read UPC-E from TIFF image with RasterEdge .NET Barcode Reader.


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.UPCE);

            // 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);
            }





How to Decode UPC-E on PDF in C#.NET



For decoding UPC-E barcode from PDF, you need to use RaterEdge Imaging PDF Dll to convert PDF pages into images before reading UPC-E barcode. We support converting PDF to five image formats, which are: TIFF, GIF, BMP, PNG and JPEG. Below C# demo code shows how to read UPC-E barcode from PDF document.


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.UPCE);

            // 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);
            }





How to Decode UPC-E on Word in C#.NET



Below two tips and C# sample codes are for how to decode UPC-E barcode from Word document.


First, please use RaterEdge MSWordDocx Dll to convert the Word document barcode pages into images;


And then take RaterEdge Barcode Add-on to read UPC-E barcode from the converted images quickly.


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.UPCE);

            // 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);
            }





How to Scan UPC-E Barcode Image on Excel in C#.NET



This C# UPC-E barcode reader control contains two different APIs for reading UPC-E barcode from whole Excel sheet or from certain defined Excel area.


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.UPCE);

            // 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);
            }





How to Scan UPC-E Barcode on PowerPoint in C#.NET



Without using any product from Microsoft Office, this C# UPC-E barcode scanner add-on is able to read and decode one or more UPC-E barcodes from 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.UPCE);

            // 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);
            }