Mike42\Escpos\Printer::setDoubleStrike PHP Method

setDoubleStrike() public method

Turn double-strike mode on/off.
public setDoubleStrike ( boolean $on = true )
$on boolean true for double strike, false for no double strike
    public function setDoubleStrike($on = true)
    {
        self::validateBoolean($on, __FUNCTION__);
        $this->connector->write(self::ESC . "G" . ($on ? chr(1) : chr(0)));
    }

Usage Example

Example #1
0
/* Cuts */
$printer->text("Partial cut\n(not available on all printers)\n");
$printer->cut(Printer::CUT_PARTIAL);
$printer->text("Full cut\n");
$printer->cut(Printer::CUT_FULL);
/* Emphasis */
for ($i = 0; $i < 2; $i++) {
    $printer->setEmphasis($i == 1);
    $printer->text("The quick brown fox jumps over the lazy dog\n");
}
$printer->setEmphasis(false);
// Reset
$printer->cut();
/* Double-strike (looks basically the same as emphasis) */
for ($i = 0; $i < 2; $i++) {
    $printer->setDoubleStrike($i == 1);
    $printer->text("The quick brown fox jumps over the lazy dog\n");
}
$printer->setDoubleStrike(false);
$printer->cut();
/* Fonts (many printers do not have a 'Font C') */
$fonts = array(Printer::FONT_A, Printer::FONT_B, Printer::FONT_C);
for ($i = 0; $i < count($fonts); $i++) {
    $printer->setFont($fonts[$i]);
    $printer->text("The quick brown fox jumps over the lazy dog\n");
}
$printer->setFont();
// Reset
$printer->cut();
/* Justification */
$justification = array(Printer::JUSTIFY_LEFT, Printer::JUSTIFY_CENTER, Printer::JUSTIFY_RIGHT);