escpos-php icon indicating copy to clipboard operation
escpos-php copied to clipboard

Epson LX-350 ESC/P

Open mashud-rana opened this issue 2 years ago • 2 comments

Is It support Epson LX-350 ESC/P model?

mashud-rana avatar Jan 31 '23 07:01 mashud-rana

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;
    }
}

vendra95 avatar Feb 10 '23 17:02 vendra95

Okay Thanks

mashud-rana avatar Feb 24 '23 15:02 mashud-rana