W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [css3-page] printing, is it a business of CSS at all?

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 25 Mar 2013 09:37:15 -0700
Message-ID: <CALRQH793g=N4W7koL2MODhzCYXi2S9pPHmAEbqWHThA0UXoZfQ@mail.gmail.com>
To: Håkon Wium Lie <howcome@opera.com>
Cc: www-style@w3.org
On Mon, Mar 25, 2013 at 2:17 AM, Håkon Wium Lie <howcome@opera.com> wrote:
> Also sprach Andrew Fedoniouk:
>
>  > If you need to print some document (the "printable") then in principle you
>  > just need two documents: so called page template document and
>  > the printable itself.
>  >
>  > Page template is a normal HTML document that may look
>  > for example as this:
>  >
>  > <html>
>  > <style>...<style>
>  > <body>
>  >   <p #header>Header....</text>
>  >   <section #content-box />
>  >   <p #footer>Page <span #page-no /></text>
>  > </body>
>  > </html>
>
> This will give you a simple document with a header and a footer. For
> the average printout, this may be sufficient.
>
> But, you rely on scripting to fill the #-marked elements. Personally,
> I prefer a CSS-based solution -- I think this is simpler for authors.

In general printing is done without any scripting at all.
Use of scripting there is rather exception than rule.

Before rendering the page the pager view sets the following in native code
on page template document (pseudocode):

root.attr("page-no", pageNo);
root.attr("page-parity", "odd" | "even");
root.find("#page-no").text(pageNo);
root.find("#pages-total").text(totalPages);
root.find("#document-title").text(printable.find("head>title").text());
root.find("#document-url").text(printable.url.text());

By having this you can style your page template for odd/even
pages for example. As any other parts.

>
> Further, once you start looking into the rich printing tradition upon
> which our civilization is built, there are many requirements. For
> example, headers will often borrow content from the page they are at.

I am not sure I understand how my solution contradicts with
the foundation of our civilization.

It has exactly the same set of features as css3-page provides
at the moment. Plus it allows to customize the printing
and paginated reading process in many ways. The mechanism
is significantly more flexible than css3-page.

> Consider this example:
>
>   http://people.opera.com/howcome/2013/tests/gkl-m.jpg
>
> Notice that the four headers are based on the entries of the
> encyclopedia. What would your script look like?

Somehow close to this (assume that script is defined
inside the template)

function onPage(pageNo) {

   var firstItem = self.onPage().first("dt").text();
   var lastItem = self.onPage().last("dt").text();

   self.find("#document-title").html( firstItem ... lastItem );
}

>
> css3-page + css3-gcpm try to encode the most common presentations for
> printed books. Hundreds of books are produced using the functionality
> described there.
>
> If we don't learn how to produce books from web content, there will
> soon be no books.

True, but I would rephrase it as:

  If we will not provide effective, convenient and extendable mechanism
  of printing then we will not have printed books.

-- 
Andrew Fedoniouk.

http://terrainformatica.com

>
> Cheers,
>
> -h&kon
>               Håkon Wium Lie                          CTO °þe®ª
> howcome@opera.com                  http://people.opera.com/howcome
Received on Monday, 25 March 2013 16:37:42 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:07 GMT