Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem printing XUL in XULrunner

125 views
Skip to first unread message

freshclick

unread,
Nov 15, 2009, 9:39:36 AM11/15/09
to
I need to print a window (or iframe) in a XULrunner standalone app. I
have tried using:


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

Jason Oster

unread,
Nov 16, 2009, 12:09:24 PM11/16/09
to
On 11/15/2009 07:39 AM, freshclick wrote:
> I need to print a window (or iframe) in a XULrunner standalone app.

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

0 new messages