コード例 #1
0
 public string Info(string fileName)
 {
     string s = "";
     ImageIO io1 = new ImageIO();
     int page = 1;
     ImageInfo oInfo;
     oInfo = io1.Info (fileName, page);
     int pages = oInfo.PageCount;
     txtRslt.Text = txtRslt.Text +  ShowInfo(oInfo, page);
     for (page = 2; page <= Math.Min(pages, 20); page++)
         {
         oInfo = io1.Info (fileName, page);
         txtRslt.Text = txtRslt.Text + ShowInfo(oInfo, page);
         System.Windows.Forms.Application.DoEvents();
         }
         return txtRslt.Text;
 }
コード例 #2
0
 internal string Info(string fileName)
 {
     string s = "";
     ImageIO io1 = new ImageIO();
     int page = 1;
     ImageInfo oInfo;
     oInfo = io1.Info(fileName, page);
     int pages = oInfo.PageCount;
     txtRslt.Text = txtRslt.Text + ShowInfo(oInfo, page);
     for (page = 2; page <= Math.Min(pages, 20); page++)
     {
         oInfo = io1.Info(fileName, page);
         txtRslt.Text = txtRslt.Text + ShowInfo(oInfo, page);
         System.Windows.Forms.Application.DoEvents();
     }
     return txtRslt.Text;
 }
コード例 #3
0
 internal string readWithZones(string fileName, int page)
 {
     BarcodeReader reader = null;
     try
     {
         reader = new BarcodeReader();
         if (tbrCode != 0) reader.TbrCode = tbrCode;// ClearImage V9 and later. Otherwise use:  reader.Read(tbrCode.ToString(), 456780);
         // for faster reading specify only required direction
         reader.Horizontal = true; reader.Vertical = true; reader.Diagonal = true;
         //configure types
         reader.Code128 = true; reader.Code39 = true;
         ImageIO io = new ImageIO();
         ImageInfo info = io.Info(fileName, page);
         string s = "======= Barcode in ZONE (upper half of the image) ===========" + Environment.NewLine;
         // Set zone to top half of the image
         reader.Zone = new Rectangle(0, 0, info.Width, info.Height / 2);
         Barcode[] barcodes = reader.Read(fileName, page);
         int cnt = 0;
         foreach (Barcode bc in barcodes)
         { cnt++; AddBarcode(ref s, cnt, bc); }
         if (cnt == 0) { s = s + "NO BARCODES"; }
         s = s + Environment.NewLine;
         s = s + "======= Barcode in IMAGE ===========" + Environment.NewLine;
         // Disable zone
         reader.Zone = new Rectangle();
         barcodes = reader.Read(fileName, page);
         cnt = 0;
         foreach (Barcode bc in barcodes)
         { cnt++; AddBarcode(ref s, cnt, bc); }
         if (cnt == 0) { s = s + "NO BARCODES"; }
         return s;
     }
     catch (Exception ex)
     {
         return ex.Message;
     }
     finally
     {
         if (reader != null) reader.Dispose();  // ClearImage V9 and later.  Immediately free memory
     }
 }
コード例 #4
0
 public string Read1DPro_Page_Zones(string fileName, int page)
 {
     string s = "";
         BarcodeReader reader = new BarcodeReader();
         // for faster reading specify only required direction
         reader.Horizontal = true; reader.Vertical = true; reader.Diagonal = true;
     #if false
         // For faster processing specify expected types
         reader.Code128 = true;
         reader.Code39 = true;
     #else
         // Read all most popular barcode types
         reader.Auto1D = true;
     #endif
         ImageIO io = new ImageIO();
         ImageInfo info = io.Info(fileName, page);
         s = s + "======= Barcode in ZONE (upper half of the image) ===========" + Environment.NewLine;
         // Set zone to top half of the image
         reader.Zone = new Rectangle (0,0,info.Width, info.Height/2);
         Barcode[] barcodes = reader.Read (fileName, page);
         int cnt = 0;
         foreach (Barcode bc in barcodes)
             {cnt++; AddBarcode(ref s, cnt, bc); }
         if (cnt == 0) 		{ s = s + "NO BARCODES"; 	}
         s = s +  Environment.NewLine;
         s = s + "======= Barcode in IMAGE ===========" + Environment.NewLine;
         // Disable zone
         reader.Zone = new Rectangle ();
         barcodes = reader.Read (fileName, page);
         cnt = 0;
         foreach (Barcode bc in barcodes)
             {cnt++; AddBarcode(ref s, cnt, bc); }
         if (cnt == 0) 		{ s = s + "NO BARCODES"; 	}
         return  s;
 }