Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm creating a report from a database. Downloading code is verboten where I work. So I'm kind of limited in what I can do (modules etc.).

I wanted to format it using HTML - easier than learning another formatting language (postscript or I don't know what else).

I'm using format and have it structured with a header, body and footer and it is readable in the browser. Now I'm trying to determine if it is possible to do proper pagination with all the normal header repeats, footer page numbers, not break rows across pages etc. I don't care if headers show in browser.

Is there a good/easy/best way to count how many lines are actually going to print (given variable length data which may wrap lines and html which doesn't count toward lines to print) from the print command on the browser so I can do some counts and plug in the header where appropriate?

Appreciate any wisdom you would share,
Gretchen

  • Comment on Pagination on HTML reports formatted with Format

Replies are listed 'Best First'.
Re: Pagination on HTML reports formatted with Format
by VSarkiss (Monsignor) on Dec 22, 2005 at 18:54 UTC
Re: Pagination on HTML reports formatted with Format
by artist (Parson) on Dec 22, 2005 at 17:50 UTC
      I've never had success with printing like that from a browser. The thing that helped me most was using a different print css file which would help with the layout when printing. The other thing I have done is run the finished HTML report programmatically through w3m (a text-mode browser which renders tables in text awesomely). If you do that, you can then count the lines and whatever, because it's just a text buffer.
        Looks like this (CSS) is the direction I'm heading. Unfortunately (or not) it requires me to come up to speed on CSS which I've not had a particular need to do over the last few years. It looks like using something like this:
        table { page-break-after: auto }
        may offer some relief since most of my data is in tables anyway. I hope to do it all inside my perl script. trying to make as simple to execute and implement as possible. Thank you all, Gretchen
Re: Pagination on HTML reports formatted with Format
by Popcorn Dave (Abbot) on Dec 23, 2005 at 04:02 UTC
    If you're using Firefox, look at page setup. You can control what is printed in the header and footer. I've used it to turn off the link, page # and date for a project I'm working on. There is also a custom option that I haven't played with but it may do what you want.

    IE has something similar but I don't know if you could control that from your program.

    HTH!

    Useless trivia: In the 2004 Las Vegas phone book there are approximately 28 pages of ads for massage, but almost 200 for lawyers.