Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

window.print() - without opening the print window [duplicate]

Possible Duplicate:
“Silent” Printing in a Web Application

I'd like the window.print() command to print directly, without opening the print window:

enter image description here

Is that possible?

like image 789
Lea Cohen Avatar asked Jul 09 '12 08:07

Lea Cohen


People also ask

What does Window print () do?

print() Opens the print dialog to print the current document. If the document is still loading when this function is called, then the document will finish loading before opening the print dialog.

How do I print a Web page without opening a popup window?

Just use window. print(); directly on the page. By itself it does not open a new window (apart from the print properties window to set printing options). Save this answer.

How do you open the print window?

Click File and then click Print. On the Print area of the File options, click the Print option to open the Print dialog box.

What is a print dialog window?

The Print dialog box lets the user select options for a particular print job. For example, the user can specify the printer to use, the range of pages to print, and the number of copies.


1 Answers

try

For Mozilla : http://forums.mozillazine.org/viewtopic.php?t=48336

When you use JavaScript's window.print() to print a Web page in IE, by default, it prompts IE's printer dialog box. To avoid this, use the following JavaScript code:

if (navigator.appName == "Microsoft Internet Explorer")
{
var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0
CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = "";
}
else {
window.print();
}

from : http://www.devx.com/tips/Tip/30834

like image 123
Pranay Rana Avatar answered Nov 14 '22 23:11

Pranay Rana