Exemplo n.º 1
0
 private void GenerateBarcode(string sz_BarcodeValue)
 {
     try
     {
         Vintasoft.Barcode.BarcodeWriter genbarcode = new Vintasoft.Barcode.BarcodeWriter();
         genbarcode.Settings.Barcode  = BarcodeType.Code128;
         genbarcode.Settings.Value    = sz_BarcodeValue;
         genbarcode.Settings.Height   = 70;
         genbarcode.Settings.MinWidth = 3;
         genbarcode.Settings.Padding  = 1;
         Bitmap bmp  = new Bitmap(genbarcode.WriteBarcode());
         double size = 0.40;
         ResizeBarcodeImage((System.Drawing.Image)bmp, size);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemplo n.º 2
0
    public void GenerateBarcode(string sz_BarcodeValue)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            Vintasoft.Barcode.BarcodeWriter genbarcode = new Vintasoft.Barcode.BarcodeWriter();
            genbarcode.Settings.Barcode  = BarcodeType.Code128;
            genbarcode.Settings.Value    = sz_BarcodeValue;
            genbarcode.Settings.Height   = 70;
            genbarcode.Settings.MinWidth = 3;
            genbarcode.Settings.Padding  = 1;

            Bitmap bmp = new Bitmap(genbarcode.WriteBarcode());
            //picBarcode.Image = (Bitmap)genbarcode.WriteBarcode();
            //   picBarcode.Image.Save(imagePath + "testimg.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

            //  Bitmap bmp = new Bitmap(imagePath + "testimg.jpg");

            double size = 0.40;
            ResizeBarcodeImage((System.Drawing.Image)bmp, size);
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }