欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程语言 > asp.net >内容正文

asp.net

ZXing.Net条形码二维码标签编辑打印软件

发布时间:2024/3/13 asp.net 62 豆豆
生活随笔 收集整理的这篇文章主要介绍了 ZXing.Net条形码二维码标签编辑打印软件 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

 

  • KopSoftTool 条形码二维码标签编辑打印软件,C#串口通信SerialPort
  • 官网 http://kopsoft.cn/
  • github源码 https://github.com/williamyang1984/KopSoftTool
  • gitee源码 https://gitee.com/william_yang/KopSoftTool

 

ZXing.Net条形码二维码打印软件

C#打印 1.建立PrintDocument对象2.设置PrintPage打印事件3.调用Print方法进行打印

Microsoft .NET Framework 4.5

ZXing.Net

BarcodeWriter用于生成图片格式的条码类,通过Write函数进行输出
BarcodeFormat枚举类型,条形码/二维码
QrCodeEncodingOptions二维码设置选项,继承于EncodingOptions,主要设置宽,高,编码方式等
MultiFormatWriter复合格式条码写码器,通过encode方法得到BitMatrix
BitMatrix表示按位表示的二维矩阵数组,元素的值用true和false表示二进制中的1和0

 

 

 

using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ZXing; using ZXing.QrCode;namespace KopSoftPrint {internal class QRCode{public void GenerateQRCode(string contents, PictureBox qrimage){BarcodeWriter barcodeWriter = new BarcodeWriter{Format = BarcodeFormat.QR_CODE,Options = new QrCodeEncodingOptions{DisableECI = true,CharacterSet = "UTF-8",Width = qrimage.Width,Height = qrimage.Height,Margin = 1 //二维码边距 }};Bitmap bitmap = barcodeWriter.Write(contents);qrimage.Image = bitmap;}} } View Code public void Print(int Number){pd.DefaultPageSettings.PaperSize = new PaperSize("", 999, 999); //设置纸张大小StandardPrintController controler = new StandardPrintController();if (dataGridView1.CurrentCell != null){for (int j = 0; j < dataGridView1.SelectedRows.Count; j++) //遍历所有选中的行 {rowIndex = dataGridView1.SelectedRows[j].Index;try{pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);pd.PrintController = controler;for (int i = 0; i < Number; i++){pd.Print();}}catch (Exception e){Console.WriteLine(e.Message);return;}finally{pd.Dispose();}}}} View Code

 

 

加强版地址 https://www.cnblogs.com/williamyoung/p/10752970.html

 

转载于:https://www.cnblogs.com/williamyoung/p/10535198.html

总结

以上是生活随笔为你收集整理的ZXing.Net条形码二维码标签编辑打印软件的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。