Pretty Printing a Web Page

Peter Hansen peter at engcorp.com
Thu May 29 12:41:31 EDT 2003


Roger wrote:
> 
> I have a very old crotchety user who can't understand why she can't
> print a perfectly formatted version of a web page my application
> creates. 
> 
> 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. 

> Can anyone offer a better solution (or at least empathy)?

My typical approach, though I have never yet followed through to a
general solution, has been to use PDF (very effective as a way of 
distributing material to be printed), in the case of Python with
ReportLab, or sometimes using the Apache XML FOP project which 
allows creating PDF files from XML source using XSL stylesheets
with an open-source engine written in Java.

You could simply add a link to the report page to "Generate PDF" 
and have the PDF auto-generated (if the page is dynamic) or 
pre-generate and cache.

-Peter




More information about the Python-list mailing list