I have developed a "printer friendly" option on pages generated by scripts. In my case, I used EmbPerl on the server, but I guess the principle is the same.

Place somewhere on the page a "printer friendly" link - and even put a printer icon next to it if you are super keen. The URL (or value in the "HREF" field) is the current URL, with a parm of "print=yes" appended to it. Now if you are already passing arguments, then you separate this with an ampersand, elsewise a ?.

Then, the server side script that generates the page looks for the presence of the "print=yes" parm. Then, when the html is being generated, select a CSS style sheet that is a "bare bones" format - no background image, no fancy colors, all that stuff. You can also have sone logic within the page generation script, such that if print is on, don't include other widgets, (including the "printer friendly" link), all that stuff.

What's that you say? Your aren't using style sheets at all? (deep sigh). Go to the back of the class. Now read all the material on the W3C page to understand why you should be.


In reply to Re: Printer Friendly Pages by Maclir
in thread Printer Friendly Pages by arashi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.