Beispiel #1
0
        internal string ShowInfo(CiImage image, int nPage)
        {
            string s = "";

            if (nPage == 1)
            {
                s += "File = " + image.FileName + Environment.NewLine +
                     "  PageCnt = " + image.PageCount.ToString() + Environment.NewLine;
            }
            if (image.PageNumber > 0)
            {
                s = s + "  Page=" + image.PageNumber.ToString() +
                    "  Format=" + System.Enum.GetName(typeof(Inlite.ClearImage.EFileFormat), image.Format) +
                    "  Size=" + image.Width.ToString() + "x" + image.Height.ToString() +
                    "  Dpi=" + image.HorzDpi.ToString() + "x" + image.VertDpi.ToString() +
                    "  Bpp=" + image.BitsPerPixel.ToString() + Environment.NewLine;
            }
            else
            {
                s = s +
                    "  Page = " + nPage.ToString() +
                    "  Format = " + System.Enum.GetName(typeof(Inlite.ClearImage.EFileFormat), image.Format) + Environment.NewLine;
            }
            return(s);
        }
Beispiel #2
0
        internal string Info(string fileName)
        {
            CiServer ci    = Inlite.ClearImageNet.Server.GetThreadServer();
            CiImage  image = ci.CreateImage();

            int page = 1;

            image.Open(fileName, page);
            int pages = image.PageCount;

            txtRslt.Text = txtRslt.Text + ShowInfo(image, page);
            for (page = 2; page <= Math.Min(pages, 20); page++)
            {
                image.Open(fileName, page);
                txtRslt.Text = txtRslt.Text + ShowInfo(image, page);
                System.Windows.Forms.Application.DoEvents();
            }
            return(txtRslt.Text);
        }
Beispiel #3
0
 private void SavePage(ref string s, CiImage image,
                       string fileOut, EFileFormat format)
 {
     // SaveAs and Append will change file name.
     //   OpenPage require original FileName.
     // To preserve  file name save Duplicate of the  image
     //       CiImage temp = image.Duplicate();
     if (fileOut != "")
     {
         if (File.Exists(fileOut))
         {
             image.Append(fileOut, format);
             s = s + "Append:" + fileOut + Environment.NewLine;
         }
         else
         {
             image.SaveAs(fileOut, format);
             s = s + "SaveAs:" + fileOut + Environment.NewLine;
         }
     }
     // temp.Close();
 }
Beispiel #4
0
        internal string readWithZones(string fileName, int page)
        {
            CiBarcodePro reader = null;

            try
            {
                CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
                reader = ci.CreateBarcodePro();
                if (tbrCode != 0)
                {
                    reader.TbrCode = tbrCode;              // ClearImage V9 and later. Otherwise use: reader.Encodings = (EBarcodeEncoding) tbrCode;
                }
                // for faster reading specify only required direction
                reader.Directions = FBarcodeDirections.cibHorz | FBarcodeDirections.cibVert | FBarcodeDirections.cibDiag;
                //configure types
                reader.Type = FBarcodeType.cibfCode128 | FBarcodeType.cibfCode39;
                CiImage image = ci.CreateImage();
                string  st    = image.FileName;
                image.Open(fileName, page);
                string s = "======= Barcode in ZONE (upper half of the image) ===========" + Environment.NewLine;
                // Set zone to top half of the image
                reader.Image = image.CreateZone(0, 0, image.Width, image.Height / 2);
                reader.Find(0);
                int cnt = 0;
                foreach (CiBarcode bc in reader.Barcodes)
                {
                    cnt++; AddBarcode(ref s, cnt, bc, image.FileName, image.PageNumber);
                }
                if (cnt == 0)
                {
                    s = s + "NO BARCODES";
                }
                s = s + Environment.NewLine;
                s = s + "======= Barcode in IMAGE ===========" + Environment.NewLine;
                // Disable zone
                reader.Image = image;
                reader.Find(0);
                cnt = 0;
                foreach (CiBarcode bc in reader.Barcodes)
                {
                    cnt++; AddBarcode(ref s, cnt, bc, image.FileName, image.PageNumber);
                }
                if (cnt == 0)
                {
                    s = s + "NO BARCODES";
                }
                s = s + Environment.NewLine;
                return(s);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Image.Close();                  // ClearImage V9 and later.  Immediately free memory
                }
            }
        }
Beispiel #5
0
 private void SavePage(ref string s, CiImage image,
     string fileOut, EFileFormat format)
 {
     // SaveAs and Appned will change file name.
         //   OpenPage require original FileName.
         // To preserve  file name save Duplicate of the  image
      //       CiImage temp = image.Duplicate();
     if (fileOut != "")
     {
         if (File.Exists(fileOut))
         {
             image.Append(fileOut, format);
             s = s + "Append:" + fileOut + Environment.NewLine;
         }
         else
         {
             image.SaveAs(fileOut, format);
             s = s + "SaveAs:" + fileOut + Environment.NewLine;
         }
     }
     // temp.Close();
 }
Beispiel #6
0
 internal string ShowInfo(CiImage image, int nPage)
 {
     string s = "";
     if (nPage == 1)
         s +=
             "File = " + image.FileName + Environment.NewLine +
                     "  PageCnt = " + image.PageCount.ToString() +  Environment.NewLine;
     if (image.PageNumber > 0) s = s +
     "  Page=" + image.PageNumber.ToString() + "  Format=" + System.Enum.GetName(typeof(Inlite.ClearImage.EFileFormat), image.Format) +
         "  Size=" + image.Width.ToString() + "x" + image.Height.ToString() +
         "  Dpi=" + image.HorzDpi.ToString() + "x" + image.VertDpi.ToString() +
         "  Bpp=" + image.BitsPerPixel.ToString() + Environment.NewLine;
     else s = s +
         "  Page = " + nPage.ToString() + "   Format = " + System.Enum.GetName(typeof(Inlite.ClearImage.EFileFormat), image.Format)
             + Environment.NewLine;
     return s;
 }