zoukankan      html  css  js  c++  java
  • .net生成条形码

    1、.net 标准库(.net standard 2.0)

      Nuget添加引用:ZXing.Net生成条形码,ZXing.Net.Bindings.ImageSharp生成图片

    public static string GenerateBarcode(string barcode)
            {
                var barcodeWriter = new ZXing.ImageSharp.BarcodeWriter<Rgba32>
                {
                    Format = BarcodeFormat.CODE_128,
                    Options = new EncodingOptions
                    {
                        Height = 100,
                        Width = 200,
                        PureBarcode = false
                    }
                };
                var name = Guid.NewGuid().ToString().Replace("-", "") + ".png";
                var localRes = AppSettingsHelper.LocalRes;
                var filePath = localRes + name;
                using (var image = barcodeWriter.Write(barcode))
                {
                    image.Save(filePath);
                }
    
                var resUrl = AppSettingsHelper.ResUrl;
                var url = filePath.Replace(localRes, resUrl);
                return url;
            }

    2、.net framework 4.6.1

    public static string GenerateBarcode(string barcode)
            {
                BarcodeWriter writer = new BarcodeWriter();
                writer.Format = BarcodeFormat.CODE_128;
                writer.Options = new ZXing.Common.EncodingOptions
                {
                    Height = 100,
                    Width = 200,
                    PureBarcode = false
                };
    
                Bitmap bitmap = writer.Write(barcode);
                var fileName = Guid.NewGuid().ToString().Replace("-", "") + ".png";
                var localRes = AppSettingsHelper.LocalRes;var filePath = localRes + fileName;
                bitmap.Save(filePath);
                var resUrl = AppSettingsHelper.ResUrl;
                var url = filePath.Replace(localRes, resUrl);
                return url;
            }
  • 相关阅读:
    poj-1069(三角形和六边形)(转)
    poj-1024(唯一最短路径)(转)
    poj-1022(四维模仿)(转)
    poj-1020(填蛋糕)(转)
    poj-1011
    poj-1010(转)
    poj-2312
    nyoj--幸运三角形
    nyoj--Divideing Jewels
    关于 APP在接入flutter之后在多任务下看不到AppName,只有APP图标,正常应该是APP图标+APP名称
  • 原文地址:https://www.cnblogs.com/flywing/p/8979278.html
Copyright © 2011-2022 走看看