Page 1 of 1

JScript: Pocket PC print with ActiveX

Posted: Fri Mar 09, 2007 6:59 pm
by ivolution
I am trying to create JScript that will print from Pocket PC (Windows CE 5) to Zebra QL220. But i cannot make it work, i get different erros 1709, 1724.

Anyone with experience to give me advice, if the code is wrong or maybe i am missing some setting on the PocketPC.

Thanks in advance, here is teh code:

Code: Select all

<script type="text/JScript">
function test() {
	PocketNice = new ActiveXObject("PocketNicePrint.Engine.1") ;
	tmp = PocketNice.Init(0);
	alert("Init - "+tmp);

	tmp = PocketNice.SetVirtualComPort(4);
	if (tmp != 0) {
		errorStr = new String("asd");
		PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: @"+errorStr+"@");
	}
	alert("SetVirtualComPort - "+tmp);

	tmp = PocketNice.SetInputFile( 0, "\My Documents\personal", "label.pnl" ) ;
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}	
	alert("SetInputFile - " + tmp) ;
	
	tmp = PocketNice.StartPrint();
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}	
	alert("StartPrint - "+tmp);

	tmp = PocketNice.Print(1);
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}	
	alert("Print - "+tmp);	
	
	tmp = PocketNice.EndPrint();
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}
	alert("EndPrint - "+tmp);	
}	
</script>
<a href=# onclick="return test();" >TEST</a>

Posted: Mon Mar 19, 2007 4:31 pm
by primoz
Try calling SetInputFile before SetVirtualComPort.

Posted: Wed Jun 10, 2009 1:10 am
by nextnicer
Great example for me, Thanks.