Re: printing events and web applications

Dave Raggett wrote:
> On Mon, 17 Jul 2006, Lachlan Hunt wrote:
>> This use case is more easily handled using a print stylesheet.
> 
> Slidy does indeed include a style sheet for print media but that 
> isn't sufficient. Currently I make slides visible/invisible by
> setting the display and visibility properties from slidy.js, and
> likewise for incrementally revealed items on each slide. Properties
> set via the CSS DOM take precedence of style rules and hence even
> with @media print style rules, the printer will only show the
> current slide and what is currently revealed on that slide.

   Instead of altering the elements' |style| attributes via the DOM, you
should have considered adding and removing class names to the |class|
attributes instead, then setting the visibility in the screen and print
medias. That way, you could use alternate style sheets without having to
have special code to detect the style sheet and set the |style|
attributes accordingly.

> In general, web applications aren't like static web pages, and
> a print out from the application will require more that just the
> use of @media print and a few style rules. The print out isn't
> just a a rearrangement of what is on the screen. For example, you 
> might make use of Ajax to pull data from the web site to provide
> the user with information designed for offline use, rather thsn
> the slice presented interactively with the online application.

   First of all, I understand why the data is dynamic, but why is it
that the presentation would be both too dynamic to be covered by class
styling _and_ require separate presentation for multiple medias? What
exactly is the use case here?

   Second, it would seem that this problem is easily solved by allowing
the use of the @media at-rule or something similar from within the
|style| attribute:

| <element style="@media screen { -dsr-print-stuff: screen; }
|                 @media print { -dsr-print-stuff: print; }" />

   Another solution would be to have a script on the server that returns
a dynamically generated style sheet and importing it with the @import
at-rule:

| <element style="@import url(css/stylegen?val1=242&val2=adef328c0);" />

   The above example should actually be possible in the existing working
draft "Syntax of CSS rules in HTML's "style" attribute".

http://www.w3.org/TR/2002/WD-css-style-attr-20020515

Received on Monday, 17 July 2006 16:32:24 UTC