zoukankan      html  css  js  c++  java
  • C# zxing插件 根据输入的字符串生成二维码

       public ActionResult Erweis(string text)
            {
                BarcodeWriter writer = new BarcodeWriter();
                writer.Format = BarcodeFormat.QR_CODE;
                QrCodeEncodingOptions options = new QrCodeEncodingOptions();
                options.DisableECI = true;
                //设置内容编码
                options.CharacterSet = "UTF-8";
                //设置二维码的宽度和高度
                options.Width = 500;
                options.Height = 500;
                //设置二维码的边距,单位不是固定像素
                options.Margin = 1;
                writer.Options = options;
    
                Bitmap map = writer.Write(text);
                string di = text + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png";
                string path = Path.Combine(Request.MapPath("/Content/"),di);
                //string filename = @"H:\桌面\截图\generate1.png";
                map.Save(path, ImageFormat.Png);
                map.Dispose();
                ViewBag.img = "/Content/"+di;
                return View();
       
            }
  • 相关阅读:
    我的python之路5
    我的python之路4
    我的python之路3
    我的python之路2
    我的python之路1
    AJAX 表单提交 文件上传
    PBKDF2WithHmacSHA1算法
    Ant 随想
    maven 启蒙
    HELLO WORLD
  • 原文地址:https://www.cnblogs.com/d0975/p/10569468.html
Copyright © 2011-2022 走看看