I haven't been able to get the nsIWebBrowserPrint to work. But I have been able to get an Iframe to print. I haven't found a way around the collpased iframe problem. Basically the iframe needs to be visible in order for the print function to work. I don't know why. It seems like a bug to me. Hiding Iframes and then printing them would be an easy way to manage printing if it worked.

The code I used was:

// Print content of iframe
function doPrint() {
        browser = document.getElementById('browser-preview');

        if ( browser.getAttribute('collapsed').search('false') != -1 ) {
            // writes content to iframe using document.write()
            refreshPreview();
            browser.contentWindow.print();
        } else {
            // write content to frame and set collapsed="false"
            renderPreview();
            browser.contentWindow.print();
        }
}

-mark

_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to