Pretty Printing a Web Page

John P replabjohn at hotmail.com
Thu May 29 13:28:40 EDT 2003


>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...
>
>The page in question is a tabular report with typical headings and columns 
>of numbers. A complicating factor is many of the column numbers are links 
>to other web pages.
>
>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)?


Roger,

You could try producing PDF. Most browsers have the ability to display PDFs 
nowadays, and they print out on paper exactly as you see them on screen. So 
you'd have the option of either displaying the PDF in the browser window as 
the main output of the report, or allowing them to click on a link to create 
and either display or download the output PDF.

If you want the ablilty to output PDF from Python, you should look the 
reportlab toolkit. It's pure Python (though you can use some C accelerators 
to speed things up if you need to), and it's Open Source. You can download 
it for free from http://www.reportlab.com/download.html.

It has the ability to do tables (including repeating the headers on multiple 
pages), and even has the ability to include web links (though off the top of 
my head, I can't remember if you need the full version of Acrobat to 
actually be able to click on them and go to the web site or not). Tabular 
data is relatively easy to lay out with reportlab, especially since it was 
originally created with that sort of reporting in mind.

Anyway, it's one possible solution.  Have a look at it and have a think.

Hope this helps,

Regards,
John

_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today! 
http://www.msn.co.uk/messenger






More information about the Python-list mailing list