escpos-php
escpos-php copied to clipboard
Epson LX-350 ESC/P
Is It support Epson LX-350 ESC/P model?
Not really, but I created a very small library to integrate in order to print. the library is incomplete but in the future I hope to be able to integrate it into the project
$connector = new FilePrintConnector('LPT1');// LPT1 on windows
$printer = new Printer($connector);
$esc = new EscP();
$connector->write($esc->setPageLengthInch(11)); //set page length in inch
$connector->write($esc->setDraftMode(true)); //set draft mode
$connector->write($esc->setBidirectionalMode(true)); //set bidirectional mode
$connector->write($esc->setsetUncondensedMode()); //set font uncondensed
$connector->write($esc->setNewPage()); //new page command
$connector->write('Hello World!'); //whatever you want
$printer->close(); //print document
class EscP
{
private $data = null;
private $dataIsSet = false;
private $success = false;
const ESC = "\x1b";
const DC2 = "\x12";
const FF = "\xc";
public function __construct()
{
}
public function setDraftMode($draft)
{
return self::ESC . "x0";
}
public function setPageLengthInch($inch)
{
return self::ESC . "C\x0" . dechex($inch); //set page length in inches
}
public function setBidirectionalMode($mode)
{
return self::ESC . "U0";
}
public function setsetUncondensedMode()
{
return self::DC2;
}
public function setNewPage()
{
return self::FF;
}
}
Okay Thanks