Ejemplo n.º 1
0
        private static void ValidateAndGenerate(Bill bill, ICanvas canvas)
        {
            ValidationResult result      = Validator.Validate(bill);
            Bill             cleanedBill = result.CleanedBill;

            if (result.HasErrors)
            {
                throw new QRBillValidationException(result);
            }

            if (bill.Format.OutputSize == OutputSize.QrCodeOnly)
            {
                QRCode qrCode = new QRCode(cleanedBill);
                qrCode.Draw(canvas, 0, 0);
            }
            else
            {
                BillLayout layout = new BillLayout(cleanedBill, canvas);
                layout.Draw();
            }
        }
Ejemplo n.º 2
0
        private void DrawPaymentPart()
        {
            const double qrCodeBottom = 42; // mm

            // title section
            _graphics.SetTransformation(ReceiptWidth + Margin, 0, 0, 1, 1);
            _yPos = SlipHeight - Margin - _graphics.Ascender(FontSizeTitle);
            //_graphics.PutText(GetText(MultilingualText.KeyPaymentPart), 0, _yPos, FontSizeTitle, true);

            // Swiss QR code section
            _qrCode.Draw(_graphics, ReceiptWidth + Margin, qrCodeBottom);

            // amount section
            DrawPaymentPartAmountSection();

            // information section
            DrawPaymentPartInformationSection();

            // further information section
            DrawFurtherInformationSection();
        }