I have been trying to figure out how to print to POS Thermal printer. I have followed all instructions on the documentation. My printer is usb and shared. I have placed smb://computername/Receipt Printer in path of Add printer.
But I got these errors in logs:
ERROR - 2022-12-03 14:21:34 --> Severity: Warning --> preg_match(): Compilation failed: invalid range in character class at offset 29 C:\xampp\htdocs\pos\vendor\mike42\escpos-php\src\Mike42\Escpos\PrintConnectors\WindowsPrintConnector.php 126
ERROR - 2022-12-03 14:21:34 --> Severity: error --> Exception: Printer ‘’ is not a valid printer name. Use local port (LPT1, COM1, etc) or smb://computer/printer notation. C:\xampp\htdocs\pos\vendor\mike42\escpos-php\src\Mike42\Escpos\PrintConnectors\WindowsPrintConnector.php 155
- MSAnswered
Hello,
Please let me know your printing settings. If you are using PHP Server this, your installation must be with localhost.
If yes, you should install the printer and then add them in SMA. Lastly update the POS settings to select the PHP Server and printer for receipt and order.
Thank you
- OAnswered
Please find attached Screenshots for settings
- OAnswered
I Installed SMA in localhost
- OAnswered
Mian Saleem I installed SMA on localhost and please find attached Screenshots for settings.
- MSAnswered
Hello,
Try to save the settings now and try again. From the logs, I see that no printer was provided with print command. Pleaes try agian and attach the latest error log.
Thank you
- OAnswered
Mian Saleem There is some problem with your Pos Controller. When you call “printReceipt” Function from “remote_printing.php” view it has all the necessary parameters with data in it. But when you send it to “pos” Controller by using the GET method it returns null there. Maybe “P” function in the pos Controller is unable to decode it that’s why it returns null value in “$data”. I have attached Screenshots for your reference.
- MSAnswered
Hello,
I am not sure; can you please try to access the data with super global $_GET by changing the first line in
p
method of pos controller to$data = json_decode($_GET['data']);
Thank you
- OAnswered
Mian Saleem Now it’s working fine.
Thank You
- Login to Reply