-1

I want to print the content of div without any popup but i when click on print it shows select printer popup. Then i found one code that working but that is in vbscript can anyone help me to understand how to write below code in javascript

<script language='VBScript'>
Sub Print()
       OLECMDID_PRINT = 6
       OLECMDEXECOPT_DONTPROMPTUSER = 2
       OLECMDEXECOPT_PROMPTUSER = 1
       call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
End Sub
document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
</script>

1 Answers1

0

Your question is currently unclear, but it sounds like you're asking "can I print a document without showing the Print dialog using only JavaScript?" The answer is no, for security reasons. You can only do that using VBScript on Internet Explorer.

If you're able to use VBScript then take a look at similar questions: javascript print without print dialog box

BoffinBrain
  • 6,337
  • 6
  • 33
  • 59