Search code examples
phpthermal-printer

Trying to connect thermal printer with pos php


I have thermal printer Black Copper BC-85AC I am trying to connect it with php here is script I am using from https://github.com/mike42/escpos-php

I tried as testing:

require 'autoload.php';
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
$connector = new FilePrintConnector("php://stdout");
$printer = new Printer($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
$printer -> close();

I there any settings I have to do before running this script through browser ? Printer is attached with the system through USB I tried a test print through computer manually and it is working but I want to print through browser using this php script.


Solution

  • I just found the solution actually I just have to replace:

    $connector = new WindowsPrintConnector("My Printer Name Here");
    

    and it is working fine.