如何使用DirectIO而不是PrintNormal打印到Zebra打印机?

时间:2011-04-26 15:06:35

标签: javascript activex zebra-printers

有没有人知道如何在以下javascript中使用DirectIO而不是PrintNormal?

printer.Open("zebraprinter");
printer.ClaimDevice(1000);
printer.DeviceEnabled = true;
printer.PrintNormal(2, "^XA");
printer.PrintNormal(2, "^LH0,0");
printer.PrintNormal(2, "^FO100,100^ASI^FDTest^FS");
printer.PrintNormal(2, "^XZ");
printer.MarkFeed(3);
printer.DeviceEnabled = false;
printer.ReleaseDevice();
printer.Close();

1 个答案:

答案 0 :(得分:0)

这是C#(Microsoft POS for .Net)代码:

PosExplorer ex = new PosExplorer();
DeviceInfo d = ex.GetDevice(DeviceType.PosPrinter, "zebraprinter");
PosPrinter printer = (PosPrinter)ex.CreateInstance(d);

printer.Open();
printer.Claim(1000);
printer.DeviceEnabled = true;

printer.DirectIO(0, 0, "^XA");
printer.DirectIO(0, 0, "^LH0,0");
printer.DirectIO(0, 0, "^FO100,100^ASI^FDTest^FS");
printer.DirectIO(0, 0, "^XZ");

printer.DirectIO(0, 0, "^MFN,F");

printer.DeviceEnabled = false;
printer.Release();
printer.Close();

请注意,我没有测试过上面的代码,但代码应该接近你想要的代码。