Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print an alternate view of your page

Printing

How to print an alternate view of your page

by  adam0101  Posted    (Edited  )
To print a completely different document, add this to your <HEAD> tag:
Code:
<link rel="alternate" media="print" href="printversion.doc">
The alternate document doesn't have to be the same file type. It can be HTML, a Word document, or something else.

To print parts of a document, add this to your <HEAD> tag:
Code:
<style type="text/css">
@media print{
  .hideOnPrint{ display:none }
}
</style>

Then add anything to the class that you want hidden when printing:
Code:
<div class="hideOnPrint">
  This [i]will[/i] show on the screen, but [i]will not[/i] be printed.
</div>

To print only user-selected sections, include the style sheet from above with this:
Code:
<div class="hideOnPrint">
  <input
    type="checkbox" 
    onclick="this.parentNode.className=this.checked?'':'hideOnPrint';"
    class="hideOnPrint">
      This will only print when my checkbox is checked.
</div>
<div class="hideOnPrint">
  <input
    type="checkbox" 
    onclick="this.parentNode.className=this.checked?'':'hideOnPrint';"
    class="hideOnPrint">
      This will only print when my checkbox is checked.
</div>

Adam
http://adameslinger.blogspot.com//
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top