Printer Friendly JavaScript

  livewire 16:31 03 Nov 2005


I am trying to find something like a JavaScript that will enable me to have a "Print page" button that will remove all the unessecary pictures and flash menus from a page so that it can be printed properly when a user goes File>Print in Internet Explorer.

Currently, when I go to choose file > print the text gets cut off as it isnt formatted properly on the page.

Do you know if something like this can be achieved using JavaScript -- or perhaps, by some other method?


  Forum Editor 17:59 03 Nov 2005

what you mean by "unnecessary pictures and Flash menus" - a script isn't going to know what's necessary or otherwise.

Here's the script to put a button on your page. Put it between <body> and <body> at the point on the page where you want the button to appear:-

<!-- Begin
if (window.print) {
document.write('<form>Click here to'
+ '<input type=button name=print value="Print" '
+ 'onClick="javascript:window.print()"> this page</form>');
// End -->

  livewire 18:43 03 Nov 2005

If you go to click here and go file>print in Internet Exlporer you can see that the text is cut off the page. Thats the problem im trying to fix...

Oddly, it works fine in Firefox :/ ?

  livewire 19:24 08 Nov 2005

I was wondering whether something like this might do the trick - but i'm not sure whether it could be implemented successfully?

click here

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

AMD Radeon Adrenalin release date, new features, compatible graphics cards

Turn a photo into 16-bit pixel art

iMac Pro release date, UK price & specs

Football : comment regarder la Ligue 1 en direct ?