| 
	
 | 
 Posted by R. Rajesh Jeba Anbiah on 07/01/85 11:55 
Erwin Moller wrote: 
    <snip> 
> I always solve this the simple way: 
> 1) Make a button: "Printer friendly page" 
> 2) If somebody hits that button, simply create a popupwindow in which you 
> retrieve the data again, and display it with little/no colors, just black 
> and white. 
> From there you can call window.print() safely. 
> 
> Alternatively, you can make a stylesheet for the printer, and tell the 
> browser to use that (without the popupwindow). That should work too, but I 
> prefer the first option because the user can see what will be printed 
> beforehand excactly. 
     <snip> 
 
    FWIW, my way: 
1. print.css set to print media and other style and alternate styles 
for screen 
2. <a href="currentlink+?print=1" rel="nofollow" 
class="print-link">Printer friendly page"</a> 
* rel="nofollow" so that the crawlers won't crawl it (avoid multiple 
crawl of same page) 
3. Add popup window for the link by hooking "print-link" class using 
Behaviour.js (now using modified better version of it and need to 
document it) 
4. The top global file sees if $_GET['print'] is set, if so, when it 
renders styleseet related links, it sets print.css to screen and trims 
other styles. 
 
   Advantages: Not much coding; easy to plug it to existing pages. 
 
-- 
  <?php echo 'Just another PHP saint'; ?> 
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/
 
  
Navigation:
[Reply to this message] 
 |