public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create an instance of BarCodeReader class and specify an area to look for the barcode
                BarCodeReader reader = new BarCodeReader(new Bitmap(dataDir + "ReadBarcodefromSpecificRegionofImage.png"), new Rectangle(0, 0, 100, 50), DecodeType.Pdf417);

                // Read all barcodes in the provided area
                while (reader.Read() == true)
                {
                    // Display the codetext and symbology type of the barcode found
                    Console.WriteLine("Codetext: " + reader.GetCodeText() + " Symbology: " + reader.GetCodeType());
                }

                // Close the reader
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_BarCodeRecognition();
            string dst = dataDir + "Code39.png";

            // Instantiate BarCodeReader object
            BarCodeReader reader = new BarCodeReader(dst, BarCodeReadType.Code39Standard);

            try
            {
                // read Code39 bar code
                while (reader.Read())
                {
                    // detect bar code orientation
                    System.Console.Write(Environment.NewLine + "Rotaion Angle: " + reader.GetAngle());
                }
                reader.Close();
            }

            catch (Exception exp)
            {

                System.Console.Write(exp.Message);
            }

            Console.WriteLine(Environment.NewLine + "Barcode recognized from " + dst);
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create an instance of BarCodeReader and set image and symbology type to recognize
                BarCodeReader barCodeReader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard);

                // Set grayscale image processing
                barCodeReader.RecognitionMode = RecognitionMode.MaxBarCodes;

                // Try to recognize all possible barcodes in the image and Display the codetext
                while (barCodeReader.Read())
                {                  
                    Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
                }                
                // Close the reader
                barCodeReader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 4
0
        public static void Run()
        {
            try
            {
                // ExStart:ReadMultipleBarcodeRegions
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create an instance of BarCodeReader class and specify an area to look for the barcode
                BarCodeReader reader = new BarCodeReader(new Bitmap(dataDir + "ReadBarcodefromSpecificRegionofImage.png"), new Rectangle(0, 0, 100, 50), DecodeType.Pdf417);

                // Read all barcodes in the provided area
                while (reader.Read() == true)
                {
                    // Display the codetext and symbology type of the barcode found
                    Console.WriteLine("Codetext: " + reader.GetCodeText() + " Symbology: " + reader.GetCodeType());
                }

                // Close the reader
                reader.Close();

                // ExEnd:ReadMultipleBarcodeRegions
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 5
0
 private void FrmPreferentialCore_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (_TicketReader != null)
     {
         _TicketReader.Close();
     }
 }
Exemplo n.º 6
0
        private void FrmCardPaying_FormClosed(object sender, FormClosedEventArgs e)
        {
            AppSettings.CurrentSetting.SaveConfig("PaymentPanelWidth", paymentPanel.Width.ToString());
            AppSettings.CurrentSetting.SaveConfig("VideoPanelHeight", videoPanel.Height.ToString());
            CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);
            if (_TicketReader != null)
            {
                _TicketReader.Close();
            }
            if (_BillPrinter != null)
            {
                _BillPrinter.Close();
            }
            if (_YCTReader != null)
            {
                _YCTReader.Close();
            }
            if (_ChargeLed != null)
            {
                _ChargeLed.Close();
            }

            if (AppSettings.CurrentSetting.EnableZST)
            {
                FrmZSTSetting frm = FrmZSTSetting.GetInstance();
                frm.ZSTReader.MessageRecieved -= new EventHandler <ZSTReaderEventArgs>(ZSTReader_MessageRecieved);
            }
            this.ucVideoes.Clear();
            this._EnterVideoes.Clear();
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            // Create an instance of BarCodeReader and set image and symbology type to recognize
            BarCodeReader barCodeReader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard);
            int counter = 0;

            // Read all the barcodes from the images
            while (barCodeReader.Read())
            {
                // Display the symbology type, codetext and Get the barcode region
                Console.WriteLine("BarCode Type: " + barCodeReader.GetCodeType());
                Console.WriteLine("BarCode CodeText: " + barCodeReader.GetCodeText());
                BarCodeRegion region = barCodeReader.GetRegion();

                if (region != null)
                {
                    // Initialize an object of type Image to get the Graphics object
                    Image image = Image.FromFile(dataDir + "code39.png");

                    // Initialize graphics object from the image
                    Graphics graphics = Graphics.FromImage(image);

                    // Draw the barcode edges,  Save the image and Fill the barcode area with some color
                    region.DrawBarCodeEdges(graphics, new Pen(Color.Red, 1f));
                    image.Save(dataDir + string.Format(@"edge_{0}.png", counter++));
                    region.FillBarCodeRegion(graphics, Brushes.Green);
                    image.Save(dataDir + string.Format(@"fill_{0}.png", counter++));
                }
            }
            barCodeReader.Close();
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.             
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
                string strFileID = "1";
                string[] strFileslist = Directory.GetFiles(dataDir + strFileID + "_*.png");
                foreach (string strFile in strFileslist)
                {
                    // We got list of all the files, now read barcodes
                    BarCodeReader reader = new BarCodeReader(strFile, DecodeType.MacroPdf417);
                    if (reader.Read() == true)
                    {
                        Console.WriteLine("File: " + strFile + " == FileID: " + reader.GetMacroPdf417FileID() +
                            " == SegmentID: " + reader.GetMacroPdf417SegmentID() + "  == CodeText: " + reader.GetCodeText());
                    }

                    // Close the reader
                    reader.Close();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 9
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            // Instantiate BarCodeReader object
            BarCodeReader reader = new BarCodeReader(dataDir + "rotatedbarcode.jpg", DecodeType.Code128);

            try
            {
                // read Code128 bar code
                while (reader.Read())
                {
                    // detect bar code orientation
                    System.Console.Write(Environment.NewLine + "Rotaion Angle: " + reader.GetAngle());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            }

            Console.WriteLine(Environment.NewLine + "Barcode recognized from " + dataDir + "rotatedbarcode.jpg");
        }
        public static void Run()
        {
            try
            {
                // ExStart:SetBarcodeOrientation
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create an instance of BarCodeReader and set image and symbology type to recognize
                BarCodeReader barCodeReader = new BarCodeReader(dataDir + "BarcodeOrientation.png", DecodeType.Code39Standard);

                // Aspose.BarCode.BarCodeRecognition.RecognitionHints is obsolete: RecognitionHints is depricated
                // Barcode orientation is detected automatically
                // barCodeReader.OrientationHints = RecognitionHints.Orientation.Rotate90;

                // Try to recognize all possible barcodes in the image and Display the codetext
                while (barCodeReader.Read())
                {
                    Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
                }

                // Close the reader
                barCodeReader.Close();
                // ExEnd:SetBarcodeOrientation
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            // create an instance of BarCodeReader class and read barcode file
            BarCodeReader barCodeReader = new BarCodeReader(dataDir + "Region.png", DecodeType.Code39Standard);

            // Try to recognize all possible barcodes in the image
            while (barCodeReader.Read())
            {
                // Get the region information
                BarCodeRegion region = barCodeReader.GetRegion();
                if (region != null)
                {
                    // Display x and y coordinates of barcode detected
                    Point[] point = region.Points;
                    Console.WriteLine("Top left coordinates: X = " + point[0].X + ", Y = " + point[0].Y);
                    Console.WriteLine("Top right coordinates: X = " + point[1].X + ", Y = " + point[1].Y);
                    Console.WriteLine("Bottom right coordinates: X = " + point[2].X + ", Y = " + point[2].Y);
                    Console.WriteLine("Bottom left coordinates: X = " + point[3].X + ", Y = " + point[3].Y);
                }
                Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
            }
            // Close reader
            barCodeReader.Close();
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_BarCodeRecognition();
            string dst     = dataDir + "Code39.png";

            // Instantiate BarCodeReader object
            BarCodeReader reader = new BarCodeReader(dst, BarCodeReadType.Code39Standard);

            try
            {
                // read Code39 bar code
                while (reader.Read())
                {
                    // detect bar code orientation
                    System.Console.Write(Environment.NewLine + "Rotaion Angle: " + reader.GetAngle());
                }
                reader.Close();
            }

            catch (Exception exp)
            {
                System.Console.Write(exp.Message);
            }

            Console.WriteLine(Environment.NewLine + "Barcode recognized from " + dst);
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            // Create an instance of BarCodeReader class and read barcode file
            BarCodeReader barCodeReader = new BarCodeReader(dataDir + "Region.png", DecodeType.Code39Standard);

            // Try to recognize all possible barcodes in the image
            while (barCodeReader.Read())
            {
                // Get the region information
                BarCodeRegion region = barCodeReader.GetRegion();
                if (region != null)
                {
                    // Display x and y coordinates of barcode detected
                    Point[] point = region.Points;
                    Console.WriteLine("Top left coordinates: X = " + point[0].X + ", Y = " + point[0].Y);
                    Console.WriteLine("Top right coordinates: X = " + point[1].X + ", Y = " + point[1].Y);
                    Console.WriteLine("Bottom right coordinates: X = " + point[2].X + ", Y = " + point[2].Y);
                    Console.WriteLine("Bottom left coordinates: X = " + point[3].X + ", Y = " + point[3].Y);
                }
                Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
            }
            // Close reader
            barCodeReader.Close();
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create an instance of BarCodeReader and set image and symbology type to recognize
                BarCodeReader barCodeReader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard);

                // Set grayscale image processing
                barCodeReader.RecognitionMode = RecognitionMode.MaxBarCodes;

                // Try to recognize all possible barcodes in the image
                while (barCodeReader.Read())
                {
                    // Display the codetext
                    Console.WriteLine("Codetext: " + barCodeReader.GetCodeText());
                }
                
                // Close the reader
                barCodeReader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 15
0
        public static void Run()
        {
            // ExStart:ReadMultipleMacropdf417BarcodeImages
            try
            {
                // The path to the documents directory.
                string   dataDir      = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
                string   strFileID    = "1";
                string[] strFileslist = Directory.GetFiles(dataDir + strFileID + "_*.png");
                foreach (string strFile in strFileslist)
                {
                    // We got list of all the files, now read barcodes
                    BarCodeReader reader = new BarCodeReader(strFile, DecodeType.MacroPdf417);
                    if (reader.Read() == true)
                    {
                        Console.WriteLine("File: " + strFile + " == FileID: " + reader.GetMacroPdf417FileID() +
                                          " == SegmentID: " + reader.GetMacroPdf417SegmentID() + "  == CodeText: " + reader.GetCodeText());
                    }

                    // Close the reader
                    reader.Close();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
            // ExEnd:ReadMultipleMacropdf417BarcodeImages
        }
        public static void Run()
        {
            try
            {
                // ExStart:SwitchBarcodeRecognitionModes
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Initialize the BarCodeReader object and  Set recognition mode and manual hints
                BarCodeReader reader = new BarCodeReader(dataDir + "datamatrix-barcode.jpg", DecodeType.DataMatrix);
                reader.RecognitionMode = RecognitionMode.ManualHints;
                reader.ManualHints     = ManualHint.InvertImage | ManualHint.IncorrectBarcodes;

                // Try to recognize all possible barcodes in the image and Display the codetext
                while (reader.Read())
                {
                    Console.WriteLine("Codetext: " + reader.GetCodeText());
                }
                // Close the reader
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
            // ExEnd:SwitchBarcodeRecognitionModes
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Initialize the BarCodeReader object and  Set recognition mode and manual hints
                BarCodeReader reader = new BarCodeReader(dataDir + "datamatrix-barcode.jpg", DecodeType.DataMatrix);
                reader.RecognitionMode = RecognitionMode.ManualHints;
                reader.ManualHints = ManualHint.InvertImage | ManualHint.IncorrectBarcodes;

                // Try to recognize all possible barcodes in the image and Display the codetext
                while (reader.Read())
                {
                    Console.WriteLine("Codetext: " + reader.GetCodeText());
                }
                // Close the reader
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 18
0
        private BarCodeReader BarCodeReaderPdf(String filename)
        {
            //Set license for Aspose.BarCode
            Aspose.BarCode.License licenceBarCode = new Aspose.BarCode.License();
            licenceBarCode.SetLicense(@"X:\awnet\TestData\Licenses\Aspose.Total.lic");

            //bind the pdf document
            Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor();
            pdfExtractor.BindPdf(filename);

            //set page range for image extraction
            pdfExtractor.StartPage = 1;
            pdfExtractor.EndPage   = 1;

            pdfExtractor.ExtractImage();

            //save image to stream
            MemoryStream imageStream = new MemoryStream();

            pdfExtractor.GetNextImage(imageStream);
            imageStream.Position = 0;

            //recognize the barcode from the image stream above
            BarCodeReader barcodeReader = new BarCodeReader(imageStream, DecodeType.QR);

            while (barcodeReader.Read())
            {
                Console.WriteLine("Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetCodeType());
            }

            //close the reader
            barcodeReader.Close();

            return(barcodeReader);
        }
Exemplo n.º 19
0
        public ActionResult Scan(HttpPostedFileBase file)
        {
            Inheritance inh     = new Inheritance();
            string      barcode = "";

            try
            {
                string path = "";
                if (file.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    path = Path.Combine(Server.MapPath("~/App_Data"), fileName);
                    file.SaveAs(path);
                }

                // Now we try to read the barcode
                // Instantiate BarCodeReader object

                BarCodeReader        reader = new BarCodeReader(path, DecodeType.Code39Standard);
                System.Drawing.Image img    = System.Drawing.Image.FromFile(path);
                System.Diagnostics.Debug.WriteLine("Width:" + img.Width + " - Height:" + img.Height);

                try
                {
                    // read Code39 bar code
                    while (reader.Read())
                    {
                        // detect bar code orientation
                        ViewBag.Title = reader.GetCodeText();
                        barcode       = reader.GetCodeText();
                    }
                    reader.Close();
                }

                catch (Exception exp)
                {
                    System.Console.Write(exp.Message);
                }
            }
            catch (Exception ex)
            {
                ViewBag.Title = ex.Message;
            }



            //inh.db.findStock(barcode);

            var result = inh.db.find(barcode).ToList();


            return(View(result));
        }
Exemplo n.º 20
0
 /// <summary>
 /// 释放对象资源
 /// </summary>
 public virtual void Dispose()
 {
     if (_TicketPrinter != null)
     {
         _TicketPrinter.Close();
     }
     if (_TicketReader != null)
     {
         _TicketReader.Close();
     }
     _PacketHandleThread.Abort();
 }
Exemplo n.º 21
0
        public static void Run()
        {
            try
            {
                // ExStart:GenerateAndRecognizeUTF8Characters
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Generate the barcode
                Bitmap         imgBarcode        = null;
                BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder {
                    EncodeType = EncodeTypes.MacroPdf417
                };

                // Set the codetext by converting it into unicode byte array
                byte[] byteArray = Encoding.Unicode.GetBytes("منحة");
                objBarCodeBuilder.SetBinaryCodeText(byteArray);
                imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
                imgBarcode.Save(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");

                // Recognize the above barcode
                BarCodeReader reader = new BarCodeReader(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");
                while (reader.Read())
                {
                    Encoding unicode = Encoding.Unicode;

                    // Get the characters array from the bytes
                    char[] unicodeChars = new char[unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length)];
                    unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0);

                    // Build unicode string
                    string strCodeText = new string(unicodeChars);
                    Console.WriteLine(strCodeText);
                }
                reader.Close();
                // ExEnd:GenerateAndRecognizeUTF8Characters
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create instance of BarCodeBuilder class and Get code text
                BarCodeReader reader = new BarCodeReader(dataDir + "Scan.jpg");
                while (reader.Read())
                {
                    Console.WriteLine("CodeText: " + reader.GetCodeText());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 23
0
 public static void Run()
 {
     try
     {
         // The path to the documents directory.
         string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
         // Create instance of BarCodeBuilder class
         BarCodeReader reader = new BarCodeReader(dataDir + "Scan.jpg");
         while (reader.Read())
         {
             // Get code text
             Console.WriteLine("CodeText: " + reader.GetCodeText());
         }
         reader.Close();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
     }
 }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            // Create an instance of BarCodeReader and set image and symbology type to recognize
            BarCodeReader barCodeReader = new BarCodeReader(dataDir + "code39.png", DecodeType.Code39Standard);

            int counter = 0;

            // Read all the barcodes from the images
            while (barCodeReader.Read())
            {
                // Display the symbology type
                Console.WriteLine("BarCode Type: " + barCodeReader.GetCodeType());
                // Display the codetext
                Console.WriteLine("BarCode CodeText: " + barCodeReader.GetCodeText());
                // Get the barcode region

                BarCodeRegion region = barCodeReader.GetRegion();
                if (region != null)
                {
                    // Initialize an object of type Image to get the Graphics object
                    Image image = Image.FromFile(dataDir + "code39.png");

                    // Initialize graphics object from the image
                    Graphics graphics = Graphics.FromImage(image);

                    // Draw the barcode edges
                    region.DrawBarCodeEdges(graphics, new Pen(Color.Red, 1f));

                    // Save the image
                    image.Save(dataDir + string.Format(@"edge_{0}.png", counter++));

                    // Fill the barcode area with some color
                    region.FillBarCodeRegion(graphics, Brushes.Green);
                    image.Save(dataDir + string.Format(@"fill_{0}.png", counter++));
                }
            }
            barCodeReader.Close();
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Initialize the BarCodeReader object and Call read method
                BarCodeReader reader = new BarCodeReader(dataDir + "Barcode2.png", DecodeType.AllSupportedTypes);
                while (reader.Read())
                {
                    Console.WriteLine(reader.GetCodeText() + " Type: " + reader.GetCodeType());
                    float percent = reader.GetRecognitionQuality();
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 26
0
 private void FrmPaying_FormClosed(object sender, FormClosedEventArgs e)
 {
     AppSettings.CurrentSetting.SaveConfig("PaymentPanelWidth", paymentPanel.Width.ToString());
     CardReaderManager.GetInstance(UserSetting.Current.WegenType).PopCardReadRequest(CardReadHandler);
     if (_TicketReader != null)
     {
         _TicketReader.Close();
     }
     if (_BillPrinter != null)
     {
         _BillPrinter.Close();
     }
     if (_YCTReader != null)
     {
         _YCTReader.Close();
     }
     if (_ChargeLed != null)
     {
         _ChargeLed.Close();
     }
 }
        public static void Run()
        {
            try
            {
                // ExStart:GenerateAndRecognizeUTF8Characters
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Generate the barcode
                Bitmap imgBarcode = null;
                BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder {EncodeType = EncodeTypes.MacroPdf417};
                
                // Set the codetext by converting it into unicode byte array
                byte[] byteArray = Encoding.Unicode.GetBytes("منحة");
                objBarCodeBuilder.SetBinaryCodeText(byteArray);
                imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
                imgBarcode.Save(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");

                // Recognize the above barcode
                BarCodeReader reader = new BarCodeReader(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");
                while (reader.Read())
                {
                    Encoding unicode = Encoding.Unicode;
                   
                    // Get the characters array from the bytes
                    char[] unicodeChars = new char[unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length)];
                    unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0);
                    
                    // Build unicode string
                    string strCodeText = new string(unicodeChars);
                    Console.WriteLine(strCodeText);
                }
                reader.Close();
                // ExEnd:GenerateAndRecognizeUTF8Characters
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            try
            {                 
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();
                BaseDecodeType[] objArray = new BaseDecodeType[] { DecodeType.Code39Standard, DecodeType.Pdf417 };

                // Initialize the BarCodeReader, Call Read() method in a loop and  Display the codetext and symbology type
                BarCodeReader reader = new BarCodeReader(dataDir + "RecognizingMultipleSymbologies.png",objArray);
                while (reader.Read())
                {
                    Console.WriteLine("Codetext: " + reader.GetCodeText());
                    Console.WriteLine("Symbology type: " + reader.GetCodeType());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            try
            {
                // Read file from directory with DecodeType.EAN13
                BarCodeReader reader = new BarCodeReader(dataDir + "Scan.jpg", DecodeType.EAN13);
                while (reader.Read())
                {
                    // Read symbology type and code text
                    Console.WriteLine("Symbology Type: " + reader.GetCodeType());
                    Console.WriteLine("CodeText: " + reader.GetCodeText());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            // Instantiate BarCodeReader object
            BarCodeReader reader = new BarCodeReader(dataDir + "rotatedbarcode.jpg", DecodeType.Code128);
            try
            {
                // Read Code128 bar code and Detect bar code orientation
                while (reader.Read())
                {
                    Console.Write(Environment.NewLine + "Rotaion Angle: " + reader.GetAngle());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
            Console.WriteLine(Environment.NewLine + "Barcode recognized from " + dataDir + "rotatedbarcode.jpg");
        }
Exemplo n.º 31
0
        public static void Run()
        {
            try
            {
                // ExStart:GetBarCodeRegionInformationfromImage
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Initialize the BarCodeReader object and Call read method
                BarCodeReader reader = new BarCodeReader(dataDir + "Barcode2.png", DecodeType.AllSupportedTypes);
                while (reader.Read())
                {
                    Console.WriteLine(reader.GetCodeText() + " Type: " + reader.GetCodeType());
                    float percent = reader.GetRecognitionQuality();
                }
                reader.Close();
                // ExEnd:GetBarCodeRegionInformationfromImage
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 32
0
        public static void Run()
        {
            try
            {
                // ExStart:RecognizeBarcodeWithChineseCharacters
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Load barcode image and Read barcode
                var reader = new BarCodeReader(dataDir + "Chinese.png", DecodeType.Pdf417);
                while (reader.Read())
                {
                    var t             = reader.GetCodeBytes();
                    var encodingValue = Encoding.GetEncoding(1254).GetString(t);
                }
                reader.Close();
                // ExEnd:RecognizeBarcodeWithChineseCharacters
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:RecognizeBarcodeWithTurkishCharacters
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Load barcode image and Read barcode
                var reader = new BarCodeReader(dataDir + "Turkish.png", DecodeType.Pdf417);
                while (reader.Read())
                {
                    var t = reader.GetCodeBytes();
                    var encodingValue = Encoding.GetEncoding(1254).GetString(t);
                }
                reader.Close();
                // ExEnd:RecognizeBarcodeWithTurkishCharacters
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Initialize the BarCodeReader
                BarCodeReader reader = new BarCodeReader(dataDir + "RecognizingMultipleSymbologies.png", BarCodeReadType.Code39Standard | BarCodeReadType.Pdf417);

                // Call Read() method in a loop
                while (reader.Read())
                {
                    // Display the codetext and symbology type
                    Console.WriteLine("Codetext: " + reader.GetCodeText());
                    Console.WriteLine("Symbology type: " + reader.GetCodeType());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            // ExStart:RecognizeSpecificBarcodeSymbology
            try
            {
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

                // Create instance of BarCodeBuilder class
                BarCodeReader reader = new BarCodeReader(dataDir + "SymbologyTypebarcode.png", DecodeType.Code128);
                while (reader.Read())
                {
                    // Display code text and Symbology Type
                    Console.WriteLine("CodeText: " + reader.GetCodeText());
                    Console.Write("Symbology Type: " + reader.GetCodeType());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from http://wwww.aspose.com/purchase/default.aspx.");
            }
            // ExEnd:RecognizeSpecificBarcodeSymbology
        }
        public static void Run()
        {
            // ExStart:ScanBarCodePicture
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageAndOptimizeBarcodeRecognition();

            try
            {
                // Read file from directory with DecodeType.EAN13
                BarCodeReader reader = new BarCodeReader(dataDir + "Scan.jpg", DecodeType.EAN13);
                while (reader.Read())
                {
                    // Read symbology type and code text
                    Console.WriteLine("Symbology Type: " + reader.GetCodeType());
                    Console.WriteLine("CodeText: " + reader.GetCodeText());
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose BarCode License. You can purchase full license or get 30 day temporary license from https://www.aspose.com/purchase/default.aspx.");
            }
            // ExEnd:ScanBarCodePicture
        }
Exemplo n.º 37
0
        private BarCodeReader BarCodeReaderPdf(string filename)
        {
            //Set license for Aspose.BarCode
            Aspose.BarCode.License licenceBarCode = new Aspose.BarCode.License();

            licenceBarCode.SetLicense(@"X:\awnet\TestData\Licenses\Aspose.Total.lic");

            //bind the pdf document
            Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor();
            pdfExtractor.BindPdf(filename);

            //set page range for image extraction
            pdfExtractor.StartPage = 1;
            pdfExtractor.EndPage = 1;

            pdfExtractor.ExtractImage();

            //save image to stream
            MemoryStream imageStream = new MemoryStream();
            pdfExtractor.GetNextImage(imageStream);
            imageStream.Position = 0;

            //recognize the barcode from the image stream above
            BarCodeReader barcodeReader = new BarCodeReader(imageStream, DecodeType.QR);
            while (barcodeReader.Read())
            {
                Console.WriteLine("Codetext found: " + barcodeReader.GetCodeText() + ", Symbology: " + barcodeReader.GetCodeType());
            }

            //close the reader
            barcodeReader.Close();

            return barcodeReader;
        }