document.getElementById("main-iframe").contentWindow.print();
where the "main-frame" element is an iframe. It only works if the
source of the iframe is an HTML document (either on the web, or on the
local computer). If the source of the iframe is a XUL document, it
returns the following error:
We are unable to print or print preview this page
Is this by design? Are XUL windows un-printable? I can't find any
specific reference to this behaviour, either in Google or on
developer.mozilla.org.
Thanks
Have you tried drawing the XUL to a canvas element and then printing the
resulting image? I'm not sure if the drawWindow() method works for XUL,
but it's worth a shot:
https://developer.mozilla.org/en/Drawing_Graphics_with_Canvas#Rendering_Web_Content_Into_A_Canvas