mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.59k stars 863 forks source link

Star SP500 - SP512 -SP700 printer setJustification for StarPrinter #1033

Open macoslinux opened 3 years ago

macoslinux commented 3 years ago

please add this new funcion to Printer.php this is for Star SP500 - SP512 -SP700 printer.

In file : Line: 887 -> Mike42\Escpos\Printer.php

/**
 * Select justification Star SP500 Printer.
 *
 * @param int $justification One of Printer::JUSTIFY_LEFT, Printer::JUSTIFY_CENTER, or Printer::JUSTIFY_RIGHT.
 */
public function setJustificationStar($justification = Printer::JUSTIFY_LEFT)
{
    self::validateInteger($justification, 0, 2, __FUNCTION__);
    $this -> connector -> write(chr(27) . chr(29) . "a" . chr($justification));
}
macoslinux commented 3 years ago

the example will be like this: $connector = new XXXXX $printer = new Printer($connector); $printer->setJustificationStar(Printer::JUSTIFY_CENTER);