Ejemplo n.º 1
0
 public ZebraUsbStream(string port)
 {
     usb               = new UsbPrinterConnector(port);
     usb.IsConnected   = true;
     base.ReadTimeout  = usb.ReadTimeout;
     base.WriteTimeout = usb.WriteTimeout;
 }
Ejemplo n.º 2
0
        public ZebraUsbStream()
        {
            System.Collections.Specialized.NameValueCollection devs = UsbPrinterConnector.EnumDevices(true, true, false);

            if (devs.Count < 1)
            {
                throw new Exception("No Zebra printers found");
            }

            usb             = new UsbPrinterConnector(devs[0].ToString());
            usb.IsConnected = true;
        }
Ejemplo n.º 3
0
        public Zebra()
        {
            //PrinterSettings ps = new PrinterSettings();
            //ps.PrinterName = "ZebraZP450-200dpi";
            //ps.Width = 203 * 4;
            //ps.Length = 203 * 6;
            //ps.Darkness = 30;

            //byte[] woop = new byte[] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
            //new SpoolPrinter(ps).Print(woop);
            var enumDevices = UsbPrinterConnector.EnumDevices();

            if (enumDevices.Keys.Count > 0)

            {
                string key = enumDevices.Keys.First();

                UsbPrinterConnector connector = new UsbPrinterConnector(key);

                string command1 = @"^XA^PW464~SD15" +

                                  @"^FO05,100^A0N,32,32^FB450,1,0,C^FDTest Line^FS ";

                command1 = command1 +

                           @"^CN1

                ^PN0        

                ^XZ";

                byte[] buffer1 = ASCIIEncoding.ASCII.GetBytes(command1);

                connector.Send(buffer1, 1, 1);
            }
        }