/// <summary>
        /// 打印二维码
        /// </summary>
        /// <param name="pageWidth">页宽度</param>
        /// <param name="pageHeight">页高度</param>
        /// <param name="item">打印二维码明细</param>
        public void DrawQrCode(int pageWidth, int pageHeight, DrawQrCodeItem item)
        {
            var coordinate = Helper.GetBarcodeCoordinate(item);
            var cmd        = Helper.GetBarcodeRotateCommand(item.Rotate);

            Writer.WriteLine($"{cmd} QR {coordinate.x} {coordinate.y} M 2 U {item.Size}");
            Writer.WriteLine($"{item.ErrorLevel}A,{item.Text}");
            Writer.WriteLine("ENDQR");
        }
Example #2
0
        /// <summary>
        /// 打印二维码
        /// </summary>
        /// <param name="x">二维码起始x坐标</param>
        /// <param name="y">二维码起始y坐标</param>
        /// <param name="text">二维码内容</param>
        /// <param name="size">尺寸</param>
        /// <param name="errorLevel">二维码纠错级别</param>
        /// <param name="rotate">旋转角度</param>
        public ZicoxPrintClient DrawQrCode(int x, int y, string text, int size, string errorLevel, int rotate)
        {
            var item = new DrawQrCodeItem()
            {
                X          = x,
                Y          = y,
                Size       = size,
                ErrorLevel = errorLevel,
                Rotate     = rotate,
                Text       = text,
            };

            this.QrCodeList.Add(item);
            return(this);
        }