Exemple #1
0
        public Gertec()
        {
            var currentContext = Android.App.Application.Context;

            _printer     = new HelperPrinterGertec(currentContext);
            _configPrint = new ConfigPrinterGertec();
            _printer.setConfigImpressao(_configPrint);

            _tef = new Ger7();
        }
Exemple #2
0
        public void setConfigImpressao(ConfigPrinterGertec config)
        {
            this.configPrint = config;

            this.stringConfig = new GEDI_PRNTR_st_StringConfig(new Paint());
            this.stringConfig.Paint.TextSize = configPrint.Tamanho;
            this.stringConfig.Paint.TextAlign = Paint.Align.ValueOf(configPrint.Alinhamento);
            this.stringConfig.Offset = configPrint.OffSet;
            this.stringConfig.LineSpace = configPrint.LineSpace;

            switch (configPrint.Fonte)
            {
                case "NORMAL":
                    this.typeface = Typeface.Create(configPrint.Fonte, TypefaceStyle.Bold);
                    break;

                case "DEFAULT":
                    this.typeface = Typeface.Create(Typeface.Default, TypefaceStyle.Normal);
                    break;

                case "DEFAULT BOLD":
                    this.typeface = Typeface.Create(Typeface.DefaultBold, TypefaceStyle.Normal);
                    break;

                case "MONOSPACE":
                    this.typeface = Typeface.Create(Typeface.Monospace, TypefaceStyle.Normal);
                    break;

                case "SANS SERIF":
                    this.typeface = Typeface.Create(Typeface.SansSerif, TypefaceStyle.Normal);
                    break;

                case "SERIF":
                    this.typeface = Typeface.Create(Typeface.Serif, TypefaceStyle.Normal);
                    break;

                default:
                    this.typeface = Typeface.CreateFromAsset(this.mainContext.Assets, configPrint.Fonte);
                    break;
            }

            if (this.configPrint.Negrito && this.configPrint.Italico)
            {
                this.typeface = Typeface.Create(typeface, TypefaceStyle.BoldItalic);
            }
            else if (this.configPrint.Negrito)
            {
                this.typeface = Typeface.Create(typeface, TypefaceStyle.Bold);
            }
            else if (this.configPrint.Italico)
            {
                this.typeface = Typeface.Create(typeface, TypefaceStyle.Italic);
            }

            if (this.configPrint.SubLinhado)
            {
                this.stringConfig.Paint.Flags = PaintFlags.UnderlineText;
            }

            this.stringConfig.Paint.SetTypeface(typeface);

        }