Beispiel #1
0
        public ResponseResult <byte[]> CreateToBytes(QRCodeCreateInput qRCodeCreateInput)
        {
            QRCodeCreateEntity qRCodeCreateEntity = QRCodeConvert.ChangeEntity(qRCodeCreateInput);

            byte[] result = QRCoderHelper.CreateQRCodeToBytes(qRCodeCreateEntity);
            return(ResponseResult <byte[]> .Success(result));
        }
Beispiel #2
0
        public ResponseResult Test(QRCodeCreateInput qRCodeCreateInput)
        {
            QRCodeCreateEntity qRCodeCreateEntity = QRCodeConvert.ChangeEntity(qRCodeCreateInput);
            string             fileName           = QRCoderHelper.CreateQRCodeToFile(qRCodeCreateEntity);

            return(ResponseResult.Success(fileName));
        }
Beispiel #3
0
        public ResponseResult <string> CreateToBase64(QRCodeCreateInput qRCodeCreateInput)
        {
            QRCodeCreateEntity qRCodeCreateEntity = QRCodeConvert.ChangeEntity(qRCodeCreateInput);
            string             result             = QRCoderHelper.CreateQRCodeToBase64(qRCodeCreateEntity);

            return(ResponseResult <string> .Success(result));
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string plainText = "";

            if (tabControl1.SelectedTab == tabPage1)
            {
                //表示需要打印格式文本
                if ((textBox_ID.Text.Trim() == string.Empty) && (textBox_Name.Text.Trim() == string.Empty) && (textBox_Time.Text.Trim() == string.Empty))
                {
                    pictureBox1.Image = null;
                    return;
                }
                // 生成二维码的内容
                plainText = "ID編碼:" + textBox_ID.Text + "\r\n客戶名稱:" + textBox_Name.Text + "\r\n出貨日期:" + textBox_Time.Text + "\r\n聯繫電話:" + textBox_phone.Text + "\r\n備註:" + textBox_txt.Text;
            }
            //else {
            //    //表示需要打印普通格式文本
            //    if (textBox_text.Text.Trim() == string.Empty) {
            //        pictureBox1.Image = null;
            //        return;
            //    }

            //    // 生成二维码的内容
            //    //plainText = "file:///C:/Users/12783/Desktop/C%23、halcon练习/C%23生成二维码/CreateCode/CreateCode/bin/Debug/uncompile.html" + MD5Encrypt(textBox_text.Text) + "&password="******"123456";
            //}

            //创建二维码返回文件路径名称
            string fileName = QRCoderHelper.CreateQRCodeToFile(plainText, Convert.ToInt32(comboBox_size.Text));

            Code_Number++;
            SaveProductInfoData();
            pictureBox1.Image = Image.FromFile(fileName);
        }
Beispiel #5
0
        //
        public FileResult MakeQRCode(string data)
        {
            var          image = QRCoderHelper.CreateQrcode(data);
            MemoryStream ms    = new MemoryStream();

            image.Save(ms, System.DrawingCore.Imaging.ImageFormat.Jpeg);
            return(File(ms.ToArray(), "image/jpeg"));
        }
Beispiel #6
0
        public IActionResult GetPTQRCode(string url, int pixel = 5)
        {
            url = HttpUtility.UrlDecode(url);
            Response.ContentType = "image/jpeg";

            var          bitmap = QRCoderHelper.GetPTQRCode(url, pixel);
            MemoryStream ms     = new MemoryStream();

            bitmap.Save(ms, ImageFormat.Jpeg);
            return(File(ms.ToArray(), "image/png"));
        }
Beispiel #7
0
        public IActionResult GetLogoQRCode(string url, string logoPath, int pixel = 5)
        {
            url                  = HttpUtility.UrlDecode(url);
            logoPath             = webHostEnvironment.WebRootPath + HttpUtility.UrlDecode(logoPath);
            Response.ContentType = "image/jpeg";

            var          bitmap = QRCoderHelper.GetLogoQRCode(url, logoPath, pixel);
            MemoryStream ms     = new MemoryStream();

            bitmap.Save(ms, ImageFormat.Jpeg);
            return(File(ms.ToArray(), "image/png"));
        }
Beispiel #8
0
        public object GetBSQRCode(string plainText, int pixel = 5)
        {
            var data = new MessageModel <string>();

            if (string.IsNullOrEmpty(plainText))
            {
                data.Message = "存储内容不能为空!";
            }
            else
            {
                data.Message  = "生成成功";
                data.Success  = true;
                data.Response = QRCoderHelper.CreateQRCodeToBase64(plainText, pixel);
            }

            return(data);
        }
Beispiel #9
0
        public void QRCode_Test()
        {
            var bitmap = QRCoderHelper.QRCode("http://virgo.vanfj.com");

            bitmap.Save("C:/dddd.bmp");
        }