Пример #1
0
        private void CreateQRCodes(string path, string voucherNumber)
        {
            QRCodeEncoder encoder = new QRCodeEncoder();

            MessagingToolkit.Barcode.Common.BitMatrix a = encoder.Encode(voucherNumber, MessagingToolkit.Barcode.BarcodeFormat.QRCode, 75, 75);
            Bitmap mBitmap = new Bitmap(a.GetWidth(), a.GetHeight());

            for (int i = 0; i < a.Height; i++)
            {
                for (int j = 0; j < a.Width; j++)
                {
                    mBitmap.SetPixel(i, j, a.Get(i, j) ? Color.Black : Color.White);
                }
            }
            mBitmap.Save(path + "\\" + voucherNumber + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
        }
Пример #2
0
        private void CreateQRCodes(string path, string voucherNumber, string financialAccount, string paymentDate, string paymentAmount)
        {
            string        content = voucherNumber + Environment.NewLine + financialAccount + Environment.NewLine + paymentDate + Environment.NewLine + paymentAmount;
            QRCodeEncoder encoder = new QRCodeEncoder();

            MessagingToolkit.Barcode.Common.BitMatrix a = encoder.Encode(content, MessagingToolkit.Barcode.BarcodeFormat.QRCode, 150, 150);
            Bitmap mBitmap = new Bitmap(a.GetWidth(), a.GetHeight());

            for (int i = 0; i < a.Height; i++)
            {
                for (int j = 0; j < a.Width; j++)
                {
                    mBitmap.SetPixel(i, j, a.Get(i, j) ? Color.Black : Color.White);
                }
            }
            mBitmap.Save(path + "\\" + voucherNumber + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
        }