How do I make prints between a web server and a local printer?

0

Good Afternoon I need to print a non-tax receipt directly from a web system. (Printer MP 20 MI X Server LocaWeb X client Windows 10 X PHP system)

The issue is that because multiple drives are using the same database I can not use local server.

Is there a way to connect the LPT1 or usb printer or even execute a .bat file to trigger this printing on local machines?

    
asked by anonymous 20.12.2016 / 18:24

1 answer

1

Thiago, you are using Web language, obviously installed on a server. Of course, if you had physical access to the server, you would call your printer over a local area network and it would work normally because the PHP language is installed inside the server.

Since the database issue is connected to multiple drives and you can not install this local system, you really do need to do the following:

  • Make a connection through a VPN with the networked printer on some desktop computer. Source: link
  • or (  2. If you are using Linux you can map the network printer so that it is available through the cups with the lp command. From this it is possible to call lp with a shell_exec () function in php.

    The solution I adopted when I had to solve this problem was to generate the barcode in PPLA and save it to a temporary file. Once this was done, it was enough to send the lp command to CUPS and he would turn to capture the file and print it out.

    Some important considerations before adopting this solution:

    The printer must be mappable by Linux. To fix the problem we mapped the printer through the mac address of the computer on which it was connected; You can send anything for printing as long as you have the correct driver installed. In my case we had no driver so as a palliative we mapped with a plain text CUPS driver and started sending a PPLA file for printing. ) Source: Printing in PHP

        
    20.12.2016 / 18:58