Developer forum

Forum » Templates » How do I use the printerfriendly function?

How do I use the printerfriendly function?


Reply
 The site:        www.ricken.com --> Bauhaus
The template: templates -> ecom -> ProductList -> Bauhaus_Norge_Table.html
I am using the new template design method.

I have a list of product that contains a "print" button. This button is supposed to open a new window with just the product information without any menus or logos etc. Currently it open a page with the product, and some menus, logo etc. How do I make it open a "blank" window with only the product information and no menus? 

Replies

 
Nicolai Høeg Pedersen
Reply

I've seen this on another website...

The information you want to print you need to wrap in a tag with id=print_content

<script language="javascript">
function Clickheretoprint()
{
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
  var content_vlue = document.getElementById("print_content").innerHTML;
 
  var docprint=window.open("","",disp_setting);
   docprint.document.open();
        docprint.document.write('<html><head><title>Print title</title>');
  
   docprint.document.write('</head><body onLoad="self.print()"><style:"text-align:left">');         
      
 

 docprint.document.write(content_vlue);         
   docprint.document.write('</center></body></html>');
   docprint.document.close();
   docprint.focus();
}
</script>

 
Reply
thanks.. I need to use a onclick event to make it work, right?
 
Reply

And what about a simple printer friendly style sheet that prints the way you want without popups or JavaScript?

 

http://imar.spaanjaars.com/240/how-do-i-hide-screen-elements-when-a-page-is-printed

Regards,

Imar

 
Reply
Yes, that was my first attempt. It didnt work for some reason. I was unable to implement it successfully.
 
Reply

In that case, I would look into figuring out why it didn't work as it's the most common, most effective, most manageable and least obtrusive way to create a printer friendly page.

Best regards,

Imar

 

You must be logged in to post in the forum