Aspose.BarCode.Examples.CSharp.ManageBarCodes.ReadBarcodeFromTIFFImages.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            try
            {
                // ExStart:ReadBarcodeFromTIFFImages
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();
                var img = Image.FromFile(dataDir + "tiffImage.tif");
                int totalFrame = img.GetFrameCount(FrameDimension.Page);

                // Feed the pages to BarCodeReader one by one
                for (int i = 0; i < totalFrame; i++)
                {
                    // Set the active page and feed it to the BarCodeReader
                    var w = img.SelectActiveFrame(FrameDimension.Page, i);
                    var bitmap = new Bitmap(img);
                    BarCodeReader reader = new BarCodeReader(bitmap, DecodeType.AllSupportedTypes);
                    while (reader.Read())
                    {
                        Console.WriteLine(reader.GetCodeText() + " " + reader.GetCodeType());
                    }
                }
                // ExEnd:ReadBarcodeFromTIFFImages
            }
            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.");
            }
        }
    }
ReadBarcodeFromTIFFImages