Page 1 of 1

JScript: ActiveX printing

Posted: Mon Mar 12, 2007 4:28 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: Fri Mar 30, 2007 11:33 am
by jurk
Error 1709 means that there is a problem while sending data to COM/BT port. For this you will have to verify that your printer works properly.

Error 1724 means that you are calling functions in invalid order. Please reffer to our documentaion. It says there what the correct function calling flow is. My guess is that you first need to SetInputFile and then call SetVirtualComPort.

Hope this helps 8)