Ejemplo n.º 1
0
        public static void Example1()
        {
            // Generate a Simple BarCode image and save as PDF

            QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium).SaveAsPng("MyQR.png");

            // This line opens the image in your default image viewer
            System.Diagnostics.Process.Start("MyQR.png");
        }
Ejemplo n.º 2
0
        public static string GetQRCode(Order order)
        {
            string sourceFile = System.IO.Path.Combine("", "template.pdf");
            string destFile   = System.IO.Path.Combine("", "qrCode.pdf");

            System.IO.File.Copy(sourceFile, destFile, true);

            string qrString = "https://groupcapstone.conveyor.cloud/Employees/ConfirmOrderComplete/" + order.Id.ToString();

            QRCodeWriter.CreateQrCodeWithLogo(qrString, "logo.png", 150).StampToExistingPdfPage("qrcode.pdf", 230, 300, 1);
            qrCode = QRCodeWriter.CreateQrCode(order.Id.ToString(), 500, QRCodeWriter.QrErrorCorrectionLevel.Medium).ToHtmlTag();
            return(qrCode);
        }
Ejemplo n.º 3
0
        public static void Example4()
        {
            // Reading and Writing Binary Data

            // using System.Linq;

            //Create Some Binary Data - This example equally well for Byte[] and System.IO.Stream
            byte[] BinaryData = System.Text.Encoding.UTF8.GetBytes("https://ironsoftware.com/csharp/barcode/");

            //WRITE QR with Binary Content
            QRCodeWriter.CreateQrCode(BinaryData, 500).SaveAsImage("MyBinaryQR.png");

            //READ QR with Binary Content
            var MyReturnedData = BarcodeReader.QuicklyReadOneBarcode("MyBinaryQR.png");

            if (BinaryData.SequenceEqual(MyReturnedData.BinaryValue))
            {
                Console.WriteLine("\t Binary Data Read and Written Perfectly");
            }
            else
            {
                throw new Exception("Corrupted Data");
            }
        }
Ejemplo n.º 4
0
        public void secme(PaintEventArgs e)
        {
            switch (barkodtip)       //tum tipler icinden
            {
            case barkodTipi.code128: //secileni
                label5.Text      = "CODE 128";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                uyar             = false;
                img1             = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.Code128, maxX, maxY).ToImage(); //olustur
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));                                                            //ve ciz
                break;

            case barkodTipi.code39:
                label5.Text      = "CODE 39";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                uyar             = false;
                img1             = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.Code39, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.code93:
                label5.Text      = "CODE 93";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                uyar             = false;
                img1             = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.Code93, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.ean13:
                label5.Text      = "EAN 13";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                if (basamak > 12)
                {
                    uyar = true;
                    //MessageBox.Show("EAN 13 tipi etikeler maksimum 12 basamaktan olusabilir. Sadece ilk 12 basamak aliniyor..");
                    basamakAyarla();
                }
                if (uyar)
                {
                    label6.Text      = "tipi etikeler maksimum 12 basamaktan olusabilir. Sadece ilk 12 basamak aliniyor..";
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    label6.Visible   = true;
                }
                e.Graphics.ScaleTransform(0.8f, 0.75f);
                img1 = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.EAN13, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.ean8:
                label5.Text      = "EAN 8";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                if (basamak > 7)
                {
                    uyar = true;
                    //MessageBox.Show("EAN 8 tipi etikeler maksimum 7 basamaktan olusabilir. Sadece ilk 7 basamak aliniyor..");
                    basamakAyarla();
                }
                if (uyar)
                {
                    label6.Text      = "tipi etikeler maksimum 7 basamaktan olusabilir. Sadece ilk 7 basamak aliniyor..";
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    label6.Visible   = true;
                }
                img1 = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.EAN8, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.upcA:
                label5.Text      = "UPC-A";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                if (basamak > 11)
                {
                    uyar = true;
                    //MessageBox.Show("UPC-A tipi etikeler maksimum 11 basamaktan olusabilir. Sadece ilk 11 basamak aliniyor..");
                    basamakAyarla();
                }
                if (uyar)
                {
                    label6.Text      = "tipi etikeler maksimum 11 basamaktan olusabilir. Sadece ilk 11 basamak aliniyor..";
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    label6.Visible   = true;
                }
                img1 = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.UPCA, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.upcE:
                label5.Text      = "UPC-E";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                if (basamak > 6)
                {
                    uyar = true;
                    //MessageBox.Show("UPC-E tipi etikeler maksimum 6 basamaktan olusabilir. Sadece ilk 6 basamak aliniyor..");
                    basamakAyarla();
                }
                if (uyar)
                {
                    label6.Text      = "tipi etikeler maksimum 6 basamaktan olusabilir. Sadece ilk 6 basamak aliniyor..";
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    label6.Visible   = true;
                }
                img1 = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.UPCE, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.msi:
                label5.Text      = "MSI";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                uyar             = false;
                img1             = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.MSI, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.itf14:
                label5.Text      = "ITF 14";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                if (basamak > 14)
                {
                    uyar = true;
                    //MessageBox.Show("ITF 14 tipi etikeler maksimum 14 basamaktan olusabilir. Sadece ilk 14 basamak aliniyor..");
                    basamakAyarla();
                }
                if (uyar)
                {
                    label6.Text      = "tipi etikeler maksimum 14 basamaktan olusabilir. Sadece ilk 14 basamak aliniyor..";
                    label5.ForeColor = Color.Red;
                    label6.ForeColor = Color.Red;
                    label6.Visible   = true;
                }
                img1 = BarcodeWriter.CreateBarcode(gecici, BarcodeWriterEncoding.ITF, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;

            case barkodTipi.qrCode:     //qr kod icin ayri komutu kullanarak tolerans ayari yapabiliyoruz
                label5.Text      = "QR CODE";
                label5.ForeColor = Color.Black;
                label6.Visible   = false;
                uyar             = false;
                img1             = QRCodeWriter.CreateQrCode(gecici, maxX, QRCodeWriter.QrErrorCorrectionLevel.Low).ToImage();
                //img1 = BarcodeWriter.CreateBarcode(icerik, BarcodeWriterEncoding.QRCode, maxX, maxY).ToImage();
                e.Graphics.DrawImage(img1, new PointF(10f, 10f));
                break;
            }
            label3.Text = img1.Width.ToString();  //resimin genislik
            label4.Text = img1.Height.ToString(); //ve yuksekligini ekranda sayisall olarak goster
        }