Pretty Printing a Web Page

Ian Bicking ianb at colorstudy.com
Thu May 29 12:41:46 EDT 2003


On Thu, 2003-05-29 at 11:06, Roger wrote:
> Perfectly formatted on paper, it should be a multipage report with 
> headings repeated on subsequent pages and not contain any of the 
> browser-generated page numbers, URLs, underlined links, etc. Even worse, 
>   it must be of a quality suitable for distribution to a group of 
> equally old crotchety professionals. Worse still, the some of the group 
> may become users and want to print perfectly formatted pages as well.

Well, you can use ReportLab to create a nice PDF.  Certainly that can be
as nice as you make it.  Otherwise, you might try using a special
printing CSS file, with things like:

a {
    text-decoration: none;
    color: #000000;
}

I.e., make links effectively disappear.  There's ways of indicating a
different CSS file for printing, but I don't remember how, or how well
that works -- you can always do it dynamically with a "printable" link,
and that gives you more flexibility.  

To make the HTML print more reliably, you can use htmldoc to create a
PDF from that.  Then you won't have to worry about browser
compatibility, and you might have more control.

  Ian







More information about the Python-list mailing list