2011-04-26 165 views
1

有沒有人知道如何使用DirectIO而不是PrintNormal爲以下JavaScript?如何使用DirectIO而不是PrintNormal打印到Zebra打印機?

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(); 
+0

只是好奇,但PrintNormal是什麼?這是一個ActiveX控件嗎?如果是的話,你在哪裏可以得到它? – 2011-06-28 22:32:44

回答

0

這裏是C#(微軟POS對於.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(); 

請注意,我沒有上面的代碼進行測試,但代碼應該是你想要的附近。