Achei isto no MSDN, obviamente isto deve funcionar direito com o IE, mas não muito bem com o Netscape ou o Mozilla. Mas a idéia está aqui.
(Basicamente você deve pôr a imagem em um frame, e tentar imprimir só o frame).
Q I have a Web page that is produced dynamically from an ASP script. The page must have a Print button on it. When a user presses the Print button, the page should be printed, but I want the Print button to be hidden on the printed page.
A There are two issues here. One is to provide a button on a Web page that, when pressed, will cause the page to be printed; the other is to prevent that button from being printed along with the output. Each of these problems has two possible solutions. The one you adopt will depend on the browser your users have.
For printing, one approach is to use the ExecWB function. Using the code in Figure 1, you would call the Print subroutine when your button is clicked. This will work in Internet Explorer 4.0 or Internet Explorer 5.x, but not in Netscape Navigator.
The other option is to use the window.print method. This will work in Netscape 4.x or Internet Explorer 5.x, but not in Internet Explorer 4.0. Documentation for the print method can be found at http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/print.asp.
Note that while the code in Figure 1 provides a method to turn off prompting before printing, the print method does not. Also note that neither of these choices will allow you to assign the printer or modify the page count, orientation, or any other layout parameters. In order to get that level of functionality, you would need to write an application that embeds the browser in it.
To prevent the button from being printed along with the content, you can try one of a few solutions. Using Cascading Style Sheets (CSS), you can set up a style that will control the layout and display on the screen and printer separately:
<style>
@media screen {.PrintOnly {display:none}}
@media print {.ScreenOnly {display:none}}
</style>
Here, I've defined two classes; one will only print, and the other will only display on the screen. So in your case, you would use something like this:
<button class=“ScreenOnly” onclick=“window.print()”>Print</button>
Then the Print button would only appear on the screen. Note that this will only work in Internet Explorer 5.x, and not in Internet Explorer 4.0 or Netscape Navigator.
You could also use a frame-based set of pages, placing the Print button in another frame:
<button onclick=“parent.frames(“Doc”).window.print()”>Print</button>
The <button> item will only work for Internet Explorer 4.0 or Internet Explorer 5.x, and not in Netscape Navigator. You could, of course, provide the same level of functionality with an <input> button, or with any element that supports an onclick event.