Ejemplo n.º 1
0
        public void PngSaveAs()
        {
            Bill bill = SampleData.CreateExample6();

            using PNGCanvas canvas =
                      new PNGCanvas(QRBill.QrBillWidth, QRBill.QrBillHeight, 144, "Helvetica, Arial, \"Liberation Sans\"");
            QRBill.Draw(bill, canvas);
            canvas.SaveAs("qrbill.png");
        }
Ejemplo n.º 2
0
        private void PngSaveAs()
        {
            Bill bill = SampleData.CreateExample6();

            using (PNGCanvas canvas =
                       new PNGCanvas(QRBill.QrBillWidth, QRBill.QrBillHeight, 144, "Helvetica, Arial, Sans"))
            {
                QRBill.Draw(bill, canvas);
                canvas.SaveAs("qrbill.png");
            }
        }
Ejemplo n.º 3
0
        public static byte[] generateQRcode(
            string account,
            string creditorName,
            string creditorAddressLine1,
            string creditorAddressLine2,
            string creditorCountryCode,
            decimal amount,
            string currency,
            string debtorName,
            string debtorAddressLine1,
            string debtorAddressLine2,
            string debtorCountryCode,
            string reference,
            string unstructuredMessage)
        {
            Bill bill = new Bill
            {
                Account  = account,
                Creditor = new Address
                {
                    Name         = creditorName,
                    AddressLine1 = creditorAddressLine1,
                    AddressLine2 = creditorAddressLine2,
                    CountryCode  = creditorCountryCode
                },
                Amount   = amount,
                Currency = currency,
                Debtor   = new Address
                {
                    Name         = debtorName,
                    AddressLine1 = debtorAddressLine1,
                    AddressLine2 = debtorAddressLine2,
                    CountryCode  = debtorCountryCode
                },
                Reference           = reference,
                UnstructuredMessage = unstructuredMessage
            };

            bill.Format.OutputSize = OutputSize.QrCodeOnly;

            string path = "qrbill.png";

            using (PNGCanvas canvas = new PNGCanvas(QRBill.QrBillWidth, QRBill.QrBillHeight, 144, "Arial"))
            {
                QRBill.DrawQrBillOnly(bill, canvas);
                canvas.SaveAs(path);
            }

            byte[] array = File.ReadAllBytes(Path.GetFullPath(path));

            return(array);
        }
Ejemplo n.º 4
0
        public static byte[] generateQRcode(
            string account,
            string creditorName,
            string creditorAddressLine1,
            string creditorAddressLine2,
            string creditorCountryCode,
            decimal amount,
            string currency,
            string debtorName,
            string debtorAddressLine1,
            string debtorAddressLine2,
            string debtorCountryCode,
            string reference,
            string unstructuredMessage)
        {
            Bill bill = new Bill
            {
                Account  = account,
                Creditor = new Address
                {
                    Name         = creditorName,
                    AddressLine1 = creditorAddressLine1,
                    AddressLine2 = creditorAddressLine2,
                    CountryCode  = creditorCountryCode
                },
                Amount   = amount,
                Currency = currency,
                Debtor   = new Address
                {
                    Name         = debtorName,
                    AddressLine1 = debtorAddressLine1,
                    AddressLine2 = debtorAddressLine2,
                    CountryCode  = debtorCountryCode
                },
                Reference           = reference,
                UnstructuredMessage = unstructuredMessage
            };
            string path = "qrbill.png";

            using (PNGCanvas canvas = new PNGCanvas(QRBill.QrBillWidth, QRBill.QrBillHeight, 144, "Arial"))
            {
                QRBill.Draw(bill, canvas);
                canvas.SaveAs(path);
            }

            return(svg);
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            // Setup bill data
            Bill bill = new Bill
            {
                // creditor data
                Account  = "CH4431999123000889012",
                Creditor = new Address
                {
                    Name         = "Robert Schneider AG",
                    AddressLine1 = "Rue du Lac 1268/2/22",
                    AddressLine2 = "2501 Biel",
                    CountryCode  = "CH"
                },

                // payment data
                Amount   = 199.95m,
                Currency = "CHF",

                // debtor data
                Debtor = new Address
                {
                    Name         = "Pia-Maria Rutschmann-Schnyder",
                    AddressLine1 = "Grosse Marktgasse 28",
                    AddressLine2 = "9400 Rorschach",
                    CountryCode  = "CH"
                },

                // more payment data
                Reference           = "210000000003139471430009017",
                UnstructuredMessage = "Abonnement für 2020"
            };

            // Generate QR bill
            string path = "qrbill.png";

            using (PNGCanvas canvas = new PNGCanvas(QRBill.QrBillWidth, QRBill.QrBillHeight, 144, "Arial"))
            {
                QRBill.Draw(bill, canvas);
                canvas.SaveAs(path);
            }

            Console.WriteLine($"QR bill saved at {Path.GetFullPath(path)}");
        }