Print to printer by specifying printer name - Javascript

1.4k views Asked by At

I have some code written in JavaScript to print a window by specifying printer name. Here is the code,

  <script>
    var pp = this.getPrintParams();
    pp.printerName = "POS-80";
    this.print(pp);
  </script>

But the problem is that chrome showing me following error on the first line of script:

Uncaught TypeError: this.getPrintParams is not a function

I have already installed adobe acrobat 9. I don't know what is the problem, need help. Thanks in advance!

1

There are 1 answers

0
Max Wyss On

This is Acrobat JavaScript, and works only within a (Acrobat) JavaScript-enabled PDF viewer.

It won't work in a HTML environment.