0

I'm working in a process of printing documents and found an alternative that is using javascript.

The code is:

 <html>
<head>
<script type="text/javascript">
function printpage()
{
   window.print();
   window.close();
}
</script>
</head>
<body onload="printpage()">
<embed src="pdfhere.pdf"/>
</body>
</html>

If I create a html page and open it with internet explorer, I sent a message to select the printer and print the document. What I want to do is automatically print the document without displaying that message thanks for your help.

user1974277
  • 77
  • 1
  • 3
  • 11
  • what if they don't have a printer and want to print to say a microsoft document or something of that nature – Ronnie Aug 28 '13 at 22:35
  • they have a printer connected all the time, so I need to remove that printer selection message @Ronnie – user1974277 Aug 28 '13 at 22:41
  • http://stackoverflow.com/questions/7891259/can-i-have-javascript-select-printer-to-use seems only IE based though – Ronnie Aug 28 '13 at 22:45
  • another for IE http://stackoverflow.com/questions/1096862/print-directly-from-browser-without-print-popup-window – Ronnie Aug 28 '13 at 22:47
  • and for chrome, granted chrome has to start with certain params: http://stackoverflow.com/questions/8742130/javascript-automate-printing-with-google-chrome – Ronnie Aug 28 '13 at 22:48

1 Answers1

2

You can't skip the browser print dialog. This is provided by your browser/OS.

window.print() is the best you can do.

Halcyon
  • 57,230
  • 10
  • 89
  • 128