开发者

get Printprogress in xul printing

I am doing this xul offline application which has lots of print job. Is there anyway to get the progress/listener from xul print, saying it is complete? I am stuck with this for sometime now, please share some ideas on how to proceed. The code for printing is as follows.

xul file

<iframe type="content-primary" flex="1" src="index.html"  />

Print Function

function getWebBrowserPrint()
{
return _content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebBrowserPrint);
}

function printpdf() {
var webBrowserPrint= getWebBrowserPrint();
var gPrintSettings = webBrowserPrint.globalPrintSettings;

gPrintSettings.footerStrLeft = "";
gPrintSettings.footerStrCenter = "";
gPrintSettings.footerStrRight = "";
gPrintSettings.headerStrLeft = "";
gPrintSettings.headerStrCenter = "";
gPrintSettings.headerStrRight = "";
gPrintSettings.printSilent = true;
gPrin开发者_如何学运维tSettings.showPrintProgress = true;
gPrintSettings.printerName = "PDF Writer";
webBrowserPrint.print(gPrintSettings, null);
}


The second parameter to webBrowserPrint.print can be an nsIWebProgressListener object. In particular you'll get an onStateChange callback with a flag including STATE_STOP when printing has finished.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜