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

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 UTC