C# PLANET Reader Library
C# Imaging - Scan PLANET in C#.NET


C# Code to Read PLANET Barcode on Image & Document






PLANET Scanning in C#.NET Overview



RasterEdge .NET Imaging Barcode Reading SDK is the premier barcode scanning toolkit which can be employed to develop applications that require reading 1D and 2D barcodes in images and documents. Our barcode reading SDK component is famous for its fast, highly accurate and reliable barcode engine for C#, VB.NET, .NET Windows and web imaging projects. With complete support of over 30 different barcode types and sub-types such as QR Code, Data Matrix, PDF417, Code 39, UPC, EAN, Code 128, etc. If you want to find a professional and flexible barcode reader, RasterEdge is your best choice.


Related .net document control helps:
asp.net mvc pdf editor control: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net edit pdf page control: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
c# asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net mvc image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net view text file in browser: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net document viewer example: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
c# asp.net mvc document viewer: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...


RasterEdge C#.NET PLANET Barcode Reader is one of the basic barcode reading applications of RasterEdge barcode reader libraries which can entitle developers and end users to read and decode PLANET linear barcode on image and document page just by using a few lines of C# codes. Except PLANET barcode, we also support other all popular postal barcodes as displayed at the bottom of this page.




PLANET Reading Features in C#.NET



Seamlessly integrated with RasterEdge .NET Imaging SDK library


Fast, accurate and reliable barcode reader in any Visual .NET application or environment


Easy to integrate PLANET reader into PDF & Word SDK libraries


Read PLANET linear barcode of any quality at any orientation


Fully-managed C# code in reading PLANET barcode


Support reading PLANET barcode from JPEG, PNG, BMP, GIF & TIFF images


Support reading PLANET barcode from PDF & Word document pages




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.




C# Code to Read PLANET from Image



With RasterEdge .NET Barcode Reading Add-on, users are capable of decoding and scanning PLANET barcode from image at high-speed. The supported image formats are JPEG, TIFF, PNG, BMP and GIF. This is one C# demo code to read PLANET from png file.


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

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



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




C#.NET Code to Recognize PLANET from TIFF Image



Following C# sample code allows users to read PLANET 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.Planet);

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





C# Code to Read PLANET from PDF



Except scanning PLANET barcode on image, we also support PLANET barcode scanning on PDF document pages. However, users who want to do this should know that, our barcode reading SDK cannot read PLANET barcode from PDF document directly, users need to convert PDF barcode pages into images at first.


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

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





C# Code to Read PLANET from Word



Like PLANET barcode reading on PDF document pages, it is necessary for users to convert Word document barcode pages into images before you can scanning PLANET barcode. Please see following detailed C# sample code.


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

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





C# Sample Code to Decode PLANET on Excel Page



Please refer to following sample code in C# class to read and scan linear PLANET barcode from Excel page. The barcode can be any area of any page of Excel document.


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

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





C# Demo Code for Scanning PLANET from PPT Document



We provide following comprehensive and precise C# sample code for users to decode and recognize PLANET barcode from any defined PowerPoint document page. And if you want to call the PPT barcode reading APIs for programing further individual barcode scanning project, please go to PPT barcode reading and scanning tutorial.


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

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