Wednesday, November 01, 2006

CSS3 Paged Media and XHTML-Print from W3C

The World Wide Web Consortium released a Last Call Working Draft of "CSS3 Module: Paged Media". CSS3 adds to web formatting: pagination, margins, size and orientation, headers and footers, widows and orphans, image orientation and page numbering. This should be enough to format a lot of printed material, including scientific papers, without the need to use any PDF or other formatting languages.

W3C also released "XHTML-Print" as a Recommendation. This is for printing from mobile and low-cost appliance devices, not requiring complex layout.

With Paged Media you will be able to say things like:
/* style sheet for "A4" printing */
@media print and (width: 21cm) and (height: 29.7cm) {
@page {
margin: 3cm;
}
}

/* style sheet for "letter" printing */
@media print and (width: 8.5in) and (height: 11in) {
@page {
margin: 1in;
}
}

@page :first {
margin-top: 10cm /* Top margin on first page 10cm */
}

@page {
margin: 10%;
@top-center { content: "Chapter" counter(chapter) }
}

From: CSS3 Module: Paged Media, W3C Working Draft 10 October 2006,
http://www.w3.org/TR/css3-page
Even if the average web browser never implements Paged Media, it is likely to be used in rendering systems. So that it may be possible to have just an XHTML version of a report stored, with the print PDF version generated as required. The XHTML could be displayed as web pages in a screen friendly format (with the CSS3 ignored). But when a high quality printed version was needed it could be run through a formatting system to add the page breaks, page numbers, chapter numbers and the like, to produce PDF.

As well as saving some space, this would allow more creative things to be done with reports. For if the Australian Government Information Management Office (AGIMO) issued a standards format for government reports, the information from across agencies could be easily analyzed. As an example the government search engine could collect and display all of the summary sections of relevant reports and reformat them into a useful report.

This would take hours of manual work at present as the PDF documents are not marked up indicating which are the summary sections and the formatting would have to be stripped off the PDF and then it manually reformatted.

1 comment:

Peter Sefton said...

The link to draft is not working. Try http://www.w3.org/TR/2006/WD-css3-page-20061010/