PHP code example of nfephp-org / posprint

1. Go to this page and download the library: Download nfephp-org/posprint library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nfephp-org / posprint example snippets


    //$this->_device = "\\.com" . $matches[1];
    $this->_device = "COM" . $matches[1];

 "mode " . $this->_winDevice . " PARITY=" . $parity{0},
 "mode " . $this->_winDevice . " DATA=8 PARITY=" . $parity{0},
 php
$filename = "/tmp/epson.prn";
$connector = new Posprint\Connector\File($filename);
$printer = new Posprint\Printers\Epson($connector);
$printer->initialize();
$printer->setBold();
$printer->text("Hello World !!");
$printer->setBold();
$printer->lineFeed(2);
$printer->setAlign("C");
$printer->text("CENTRAL");
$printer->lineFeed(2);
$printer->cut();
$printer->send();