这段代码不是可以扑捉打印状态吗。
myDoc = {...
onState:function(job)
{
alert(job.status+job.statusText);
}
...
}; 当打印状态发生变化时,会触发 onState方法,你可以通过 job参数,取得当前打印任务的相关属性,比如,打印机(printerName)、文档名(document)、打印状态(status)、打印状态描述(statusText)等,其中,job.status是数值型,你可以通过位运算,如下所示。
function getStatusText(status) {
var JOB_STATUS_PAUSED = 1;
var JOB_STATUS_ERROR = 2 ;
var JOB_STATUS_DELETING = 4 ;
var JOB_STATUS_SPOOLING = 8 ;
var JOB_STATUS_PRINTING = 16 ;
var JOB_STATUS_OFFLINE = 32 ;
var JOB_STATUS_PAPEROUT = 64 ;
var JOB_STATUS_PRINTED = 128 ;
var JOB_STATUS_DELETED = 148 ;
var JOB_STATUS_BLOCKED_DEVQ = 512;
var JOB_STATUS_USER_INTERVENTION = 1024;
var JOB_STATUS_RESTART = 2048;
var message = '';
if (status & JOB_STATUS_PAUSED) message += "暂停 -";
if (status & JOB_STATUS_ERROR) message += "出错 -";
if (status & JOB_STATUS_DELETING) message += "正在删除 -";
if (status & JOB_STATUS_SPOOLING) message += "进入队列 -";
if (status & JOB_STATUS_PRINTING) message += "正在打印 -";
if (status & JOB_STATUS_OFFLINE) message += "脱机 -";
if (status & JOB_STATUS_PAPEROUT) message += "没纸了 -";
if (status & JOB_STATUS_PRINTED) message += "打印结束 -";
if (status & JOB_STATUS_DELETED) message += "删除 -";
if (status & JOB_STATUS_BLOCKED_DEVQ) message += "堵了 -";
if (status & JOB_STATUS_USER_INTERVENTION) message += "用户正在介入 -";
if (status & JOB_STATUS_RESTART) message += "重启了 -";
return message;
}