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.
精彩评论