lodop判断是否打印成功
需要引用js
<script src="js/jquery-3.3.1.js"></script>
<script src="js/LodopFuncs.js"></script>
<h2><font color="#009999">演示如何获得打印状态及控制打印:</font>
</h2>
<p>
1、先点<a href="javascript:MyPrint()">执行打印</a>获得该打印的JOB代码:<input type="text" id="T1" size="48"><br>
</p>
2、<input type="button" value="获得该JOB是否已经打印成功:"
onclick="document.getElementById('T2').value = getStatusValue('PRINT_STATUS_OK', document.getElementById('T1').value, document.getElementById('T2'))"><input type="text" id="T2" size="48">(1-成功
0-不成功)<br>
3、<input type="button" value="获得该JOB是否还处在队列中:"
onclick="document.getElementById('T3').value = getStatusValue('PRINT_STATUS_EXIST', document.getElementById('T1').value, document.getElementById('T3'))"><input type="text" id="T3" size="48">(1-在
0-不在,可能已打完或未打而删除,不在队列里说明打印成功)<br />
12.<asp:Button ID="Button1" runat="server" Text="判断" />
<input type="button" value="测试" onclick="document.getElementById('Text1').value = getStatusValue('PRINT_STATUS_EXIST', document.getElementById('T1').value, document.getElementById('Text1'))" />
<input type="text" id="Text1" size="48">
<br />
<script type="text/javascript">
var LODOP, P_ID = "", TaskID1, TaskID2, t, waiting = false, c = 0, loop = 0; //声明为全局变量
function getStatusValue(ValueType, ValueIndex, oResultOB) {
LODOP = getLodop();
if (LODOP.CVERSION) LODOP.On_Return = function (TaskID, Value) { oResultOB.value = Value; };
var strResult = LODOP.GET_VALUE(ValueType, ValueIndex);
if (!LODOP.CVERSION) return strResult; else return "";
};
function MyPrint() {
LODOP = getLodop();
LODOP.PRINT_INIT("打印控件功能演示_Lodop功能_获得打印状态1");
LODOP.ADD_PRINT_TEXT(50, 231, 260, 39, "打印的第一页内容");
//LODOP.NEWPAGEA();
//LODOP.ADD_PRINT_TEXT(50, 231, 260, 39, "打印的第二页内容");
LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
if (LODOP.CVERSION) {
LODOP.On_Return = function (TaskID, Value) { document.getElementById('T1').value = Value; };
//LODOP.PRINTA();
LODOP.PRINT();
return;
} else document.getElementById('T1').value = LODOP.PRINTA();
};
$(function () {
$("#Button1").click(function () {
var b = document.getElementById('T1').value;
// var c = document.getElementById('T3');
var d = document.getElementById('Text1');
var a = getStatusValue('PRINT_STATUS_EXIST', b, d);
alert(a)
// document.getElementById('T3').value = a;
});
});
</script>
一般情况下,如果job不在队列中,那么就可以认为是打印成功