How to print directly without opening the browser dialog?

4

I am developing a web system where I need to print a label and a non-tax receipt after submitting a certain form. To perform this action, I have two printers:

  • Non-Fiscal Matrix Printer MP-20 MI - For non-tax coupon;
  • Zebra Thermal Printer TLP 2844 Non-Fiscal - For Label;

I was even able to print using the PHP php_printer DLL with php, but it was not working the way I needed: print hangs, sometimes sends and prints nothing. It's very unstable!

I tried to make use of the scpos-php library and the dot matrix printer worked correctly, however on the Zebra printer it does not print the text that I send.

I see that it is possible to make a configuration in the browser (Firefox only) so that the user can print without opening the dialog, but for this the user needs to perform a configuration in the browser and it is possible to use only one printer and not two , as needed.

For compatibility issues I can not have a java applet on the machine.

I can not use VBScript or ActiveX because I can not force the user to use only a specific browser.

Is there any other way to make this impression with PHP, Node.js or javascript?

    
asked by anonymous 19.09.2016 / 22:49

1 answer

5

Direct response: No, it is not possible.

Imagine if it were possible, you visit a website without wanting to start printing unwanted things on your printer without your permission, have you ever imagined?

It is the browser that runs the print server, it is client-site, PHP has nothing to do with it. Unless you want to command something to print on the server-site, which is where PHP runs, that is, have it printed on some printer that is connected to the server-side server, but printing on the client side without a permission is not possible.

You need to understand the difference between server-side and client-side . The php is interpreted on the server-side and shown for the client-side . Sending a print using a shell or exec command will command on server-side .

    
09.11.2016 / 16:40