C#使用第三方组件生成二维码汇总

2019-12-30 14:59:55于丽

1.2):具体生成二维码方法如下



    private void GenerateQRBySpire()
    {
      BarcodeSettings bs = new BarcodeSettings()
      {
        Data = "This is qr code.",
        Type = BarCodeType.QRCode,
        TopTextColor = Color.Red,
        ShowCheckSumChar = false,
        ShowText = false
      };
      //Generate the barcode based on the this.barCodeControl1
      BarCodeGenerator generator = new BarCodeGenerator(bs);
      Image barcode = generator.GenerateImage();

      //save the barcode as an image
      barcode.Save(@"E:barcode-2d.png");
    }

1.3):附加具体生成条形码方法如下



    private void GenerateBarCodeBySpire()
    {
      BarcodeSettings bs = new BarcodeSettings()
      {
        Data = "This is barcode.",
        ShowCheckSumChar = false,
        TopTextColor = Color.Red,
        ShowTopText = false,
        ShowTextOnBottom = true
      };
      //Generate the barcode based on the this.barCodeControl1
      BarCodeGenerator generator = new BarCodeGenerator(bs);
      Image barcode = generator.GenerateImage();

      //save the barcode as an image
      barcode.Save(@"E:barcode.png");
    }

更多详细信息请参考如下链接:

http://www.easck.com/

http://www.easck.com/Knowledgebase/Spire.BarCode/Program-Guide/Programme-Guide-for-Spire.BarCode.html

3.通过BarcodeLib(BarcodeLib.Barcode.ASP.NET.dll)来实现

下载对应dll的连接为 http://www.easck.com/asp_net/

4.1):具体生成二维码方法如下



    private void GenerateQRByBarcodeLib()
    {
      QRCode qrbarcode = new QRCode();
      qrbarcode.Encoding = QRCodeEncoding.Auto;
      qrbarcode.Data = "336699885522 This is Eric Sun Testing.";

      qrbarcode.ModuleSize = 10;
      qrbarcode.LeftMargin = 8;
      qrbarcode.RightMargin = 8;
      qrbarcode.TopMargin = 8;
      qrbarcode.BottomMargin = 8;
      qrbarcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif;

      // Save QR Code barcode image into your system
      qrbarcode.drawBarcode("E:/csharp-qrcode-lib.gif");
    }

4.2):附加具体生成条形码方法如下



    private void GenerateLinearByBarcodeLib()
    {
      Linear barcode = new Linear();
      barcode.Type = BarcodeType.CODE128;
      barcode.Data = "CODE128";
      // other barcode settings.

      // save barcode image into your system
      barcode.drawBarcode("E:/barcode.png");
    }

我们使用的是试用版(带水印的......),还有付费的正版,详情请参考如下链接:

http://www.easck.com/asp_net/


注:相关教程知识阅读请移步到c#教程频道。