Пример #1
0
        private static void TesteImagem()
        {
            var printStatus = new StandardSection()
            {
                Justification = FontAlignment.Left,
                HeightScalar  = FontHeighScalarEnum.h1,
                WidthScalar   = FontWidthScalarEnum.w1,
                Font          = ThermalFontsEnum.B,
                AutoNewline   = true,
            };

            var document = new StandardDocument()
            {
                //Não esquecer de setar essa prop
                CodePage = CodePagesEnum.CPSPACE,
            };

            document.Sections.Add(new Placeholder());

            using (var printer = new GenericPrinter(PortaCom))
            {
                var image = new Imaging.PrinterImage((Bitmap)Image.FromFile(@"XING_B24.BMP"));
                image.ApplyDithering(Imaging.AlgorithmsEnum.JarvisJudiceNinke, 128);

                for (int i = 3; i >= 1; i--)
                {
                    printer.SetImage(image, document, 0, (FontAlignment)i);
                    printer.PrintDocument(document);
                }

                printer.FormFeed(5);
                printer.Cut(CutModeEnum.Parcial);
            }
        }