Lets use a photo like this as an example, and pretend it has a different colored background:
Now we want it to have a white background, and be nicely formatted for printing, like so:
What this code does is take any text, images, or links within a div named content, and overwrite it as the new content of the web page for the client. It also removes all CSS from the page automatically and formats it in a way that is nice for printing.
The following is another way in which to implement this technique:
Lastly, these are some ways in which to use the code on your site:
<button onClick=’write(document.getElementById(“content”).innerHTML)’>View Printable Version</button>
<a href=” onClick=’write(document.getElementById(“content”).innerHTML)’>View Printable Version</a>