[Project_owners] Printing - Number of Pages

Brian King brian at mozdev.org
Fri Aug 25 15:03:01 EDT 2006


I am working on a printing extension for Firefox, and at various 
intervals need to get the number of print pages of the loaded document.

This code should do the job:

var print = PrintUtils.getWebBrowserPrint();
var numpages = print.printPreviewNumPages;

... but the only catch (as the var name suggests) is that you have to be 
in print preview mode for it to work. So I have an ugly hack in place to 
toggle back and forth between print preview mode, but it is very 
disconcerting on the eye. And even if I try to hide the content and 
replace with something of my own when in print preview mode, I can't 
suppress the print preview progress window.

So my question is ... is there an alternative way to get the number of 
print pages of the loaded document?

-- 
Brian King
www.mozdev.org - free project hosting for the Mozilla community


More information about the Project_owners mailing list