Beispiel #1
0
        private static void TesteCodigoBarras()
        {
            using (var printer = new GenericPrinter(PortaCom))
            {
                //Code128
                Code128 code = new Code128()
                {
                    EncodeThis             = "12321321312",
                    BarcodeWidthMultiplier = 2,
                    BarcodeDotHeight       = 50, //Autura do codigo
                    HriPosition            = Printer.Barcodes.Enums.HRIPositions.Below,
                    Mode        = Code128.Modes.A,
                    BarcodeFont = ThermalFontsEnum.A
                };

                printer.PrintASCIIString("Code 128 - Altura 50");
                printer.FormFeed(1);
                printer.PrintBarCode(code);
                printer.FormFeed(1);
                printer.Reinitialize();


                //Code39
                Code39 code39 = new Code39()
                {
                    EncodeThis             = "12321321312",
                    BarcodeWidthMultiplier = 2,
                    BarcodeDotHeight       = 30, //Autura do codigo
                    BarcodeFont            = ThermalFontsEnum.A
                };

                printer.PrintASCIIString("Code 39 - Altura 30");
                printer.FormFeed(1);
                printer.PrintBarCode(code);
                printer.FormFeed(1);
                printer.Reinitialize();

                //ITF
                ITF itf = new ITF()
                {
                    EncodeThis             = "12321321312",
                    BarcodeDotHeight       = 100, //Autura do codigo
                    BarcodeWidthMultiplier = 2,
                    BarcodeFont            = ThermalFontsEnum.A
                };

                printer.PrintASCIIString("ITF - Altura 100");
                printer.FormFeed(1);
                printer.PrintBarCode(code);
                printer.FormFeed(3);
                printer.Reinitialize();

                //NFCe
                printer.PrintASCIIString("Exemplo QRCode NFCe\n");
                var qrCodeNFCe = new QrCode(4, "http://www.sefaz.mt.gov.br/nfce/consultanfce?chNFe=51131003460900000290650010000000031000000031&nVersao=100&tpAmb=2&cDest=02801244147&dhEmi=323031332D31302D32345431363A32313A30332D30333A3030&vNF=1,00&vICMS=0,00&digVal=78764D34764E2B48586A735657516F653474415A547855547764383D&cIdToken=000001&cHashQRCode=7AF4285DA2D18133BEF9F9370AD4A185B2527AFB");

                printer.PrintBarCode(qrCodeNFCe);
                printer.FormFeed(1);
                printer.Reinitialize();

                //Sat
                printer.PrintASCIIString("Exemplo QRCode SAT\n");
                var qrCodeSat = new QrCode(4, "http://www.sefaz.mt.gov.br/nfce/consultanfce?chNFe=51131003460900000290650010000000031000000031&nVersao=100&tpAmb=2&cDest=02801244147&dhEmi=323031332D31302D32345431363A32313A30332D30333A3030&vNF=1,00&vICMS=0,00&digVal=78764D34764E2B48586A735657516F653474415A547855547764383D&cIdToken=000001&cHashQRCode=7AF4285DA2D18133BEF9F9370AD4A185B2527AFB");

                printer.PrintBarCode(qrCodeNFCe);
                printer.FormFeed(1);

                printer.Cut(CutModeEnum.Parcial);
                printer.Reinitialize();
            }
        }