Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string barcode = Request.QueryString["barcode"];

            if (!string.IsNullOrWhiteSpace(barcode))
            {
                Bitmap image = BarcodeHelper.GenerateBarcodeImage(barcode);
                image.Save(Response.OutputStream, ImageFormat.Jpeg);
                Response.ContentType = "image/jpeg";
            }
        }
Пример #2
0
        public ActionResult BarcodeImage(string barcode)
        {
            FileContentResult result;

            using (var memStream = new MemoryStream())
            {
                Bitmap image = BarcodeHelper.GenerateBarcodeImage(barcode);
                image.Save(memStream, ImageFormat.Jpeg);
                result = File(memStream.GetBuffer(), "image/jpeg");
            }
            return(result);
        }