mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.55k stars 863 forks source link

Couldn't print to this printer: Failed to copy file to printer #710

Open dadhaniamitul opened 5 years ago

dadhaniamitul commented 5 years ago

I need to print receipt by using esc-pos PHP library. So my code is working fine in localhost but in dedicated sever its giving "Couldn't print to this printer: Failed to copy file to printer" error. I have used WindowsPrintConnector

$connector = new WindowsPrintConnector('XP-80C');

mike42 commented 5 years ago

This is a server-side print library, and I'm guessing that your dedicated server does not have a printer connected to it.

I would suggest sharing the printer, and printing over the LAN (put the PHP instance on the same LAN as the printers it is going to print to). You can use new WindowsPrintConnector("smb://user:password@host/printer") over the LAN from a Windows or Linux host.

We also have information in the FAQ under "Can I print from my server on the Internet?. Internet printing is possible, but it's a lot more work to securely and reliably.

Remember that PHP runs on the server, not your browser!