Question: Thermal Printer Not Working

Thermal Printer Not Working

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/Re

O

Owais

Asked

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

  • MS

    Mian Saleem

    Answered

    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

  • O

    Owais

    Answered

    Please find attached Screenshots for settings

  • O

    Owais

    Answered

    I Installed SMA in localhost

  • O

    Owais

    Answered

    Mian Saleem I installed SMA on localhost and please find attached Screenshots for settings.

  • MS

    Mian Saleem

    Answered

    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

  • O

    Owais

    Answered

    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.

  • MS

    Mian Saleem

    Answered

    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

  • O

    Owais

    Answered

    Mian Saleem Now it’s working fine.

    Thank You

  • Login to Reply