No subject


Fri Apr 16 10:15:54 EDT 2010


to have a data-URL spawned window handle templating, rendering, and
printing of a receipt, hopefully while minimized and as quickly as
possible, before closing itself and returning to the main application.
 Experiments using hidden iframes, etc. for the content did not prove
successful.  The printing would also need the option of being silent
(not prompting for which printer to use, etc.) and of remembering
settings independently of the operating system settings, and of being
able to work if spawned from modal pop-up windows.

To handle this I turned to XPCOM (nsIWebBrowserPrint), though these
days we may want to experiment with window.print and the
print.always_print_silent Mozilla preference.  At the time, including
the XPCOM directly in the print window would lead to crashes, so as a
workaround we began injecting it into the window as a callback
function, the same way we inject xulG into content windows elsewhere
in the client.  The onload handler for the print window would call the
injected function, which would handle the printing and close the
window (the function itself having a reference to the window in a
closure).

Something like:

JSAN.use('util.window); var win =3D new util.window();
var w =3D win.open(print_url);
w.go_print =3D function () { xpcom_print(w); w.minimize(); w.close(); }

There's a bug where the go_print function is never seen by the onload
handler.  A setTimeout was attempted to see if it was a race
condition, and thus the origin of the "2-second workaround", but it
never sees the function either.  This kind of reminds me of the pain
we're seeing now with Dojo and Mozilla and premature onload events.
Hrmm.

If you're able to reproduce this bug on demand (or at least fairly
often), especially in a non-production system that we can tweak
without affecting anyone, then we can try out alternate
implementations (especially with modern xulrunners) to see if they fix
the problem.

--=20
Jason Etheridge
=A0| VP, Tactical Development
=A0| Equinox Software, Inc. / Your Library's Guide to Open Source
=A0| phone:=A0 1-877-OPEN-ILS (673-6457)
=A0| email:=A0 jason at esilibrary.com
=A0| web:=A0 http://www.esilibrary.com


More information about the Open-ils-dev mailing list