W3C home > Mailing lists > Public > public-webapi@w3.org > July 2006

printing events and web applications

From: Dave Raggett <dsr@w3.org>
Date: Sun, 16 Jul 2006 16:51:16 +0100 (BST)
To: public-webapi@w3.org
Message-ID: <Pine.LNX.4.62.0607161618020.8983@localhost.localdomain>

Hash: SHA1

Internet Explorer provides two events that are very useful
for web applications involving dynamic html when it comes to
printing. These are onbeforeprint and onafterprint.


     Use this event to temporarily reconfigure the web page
     to provide a printable version prior to the browser
     submiting the page to the printer queue


     Use this event to restore the web page to its state
     when onbeforeprint was raised. This event is raised
     immediately after the page has been submitted to the
     printer queue, and before the printer gets going.

As an example, consider HTML Slidy


This is a web application that presents a sequence of slides in
a similar manner to Microsoft PowerPoint. The difference is that
all slides are held in a single XHTML (or HTML) file that can be
viewed across a wide range of browsers and operating systems.

Slidy uses CSS for layout and a linked script to present div 
elements as slides, one slide at time. The other slides are
hidden by setting the div element's display property to none and 
visibility to hidden.

This looks great for presentation purposes, but if the user tries
to print the page then the browser will only print the currently
visible slide. Most of the time, that isn't what people expect.
Instead they want to have all of the slides printed.

Slidy's help page instructs people to switch to a mode where all
slides are shown before printing. On Internet Explorer, however,
that isn't necessary since the onbeforeprint and onafterprint
events can be made to apply the desired behavior automatically.

A work around is to provide a printer button as part of the page's 
user interface. This can invoke a script that makes the necessary 
rearrangements, invokes window.print() and then tidies up 
afterwards. The problem with this approach is that users are 
familiar with the browser's print menu item and the Ctrl-P shortcut, 
and as such many people will try that even if a print button is 
provided as part of the Web app. The same applies to the technique
of offering a link to a printable version of the page.

Printing continues to be important for end users, and should be
easy and reliable for web applications involving dynamic html.
I therefore would like to see the W3C DOM expanded to include
the before and after printing events that Internet Explorer
has supported for many years.

   Dave Raggett <dsr@w3.org>  W3C lead for multimodal interaction
   http://www.w3.org/People/Raggett +44 1225 866240 (or 867351)

Version: GnuPG v1.4.1 (GNU/Linux)

Received on Sunday, 16 July 2006 15:52:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:21 UTC