Search code examples
phpescpos

Mike42 ESCPOS - Print 4 png files in one line


When I want to print 4 PNG files (100x100) via Mik42/ESCPOS. It printed each PNG file on each line. Is there any method to print all four PNG files in one line?

$printer -> setJustification(Printer::JUSTIFY_LEFT);
$printer -> graphics($HC1,false);
$printer -> graphics($HC1,false);
$printer -> graphics($HC1,false);
$printer -> graphics($HC1,false);

Solution

  • One of the following can be considered.

    1. Create one image data by arranging four image data in one horizontal line and print it.
    2. Set the page mode by combining the raw ESC/POS command data, repeat the print start position with the raw ESC/POS command data after the graphics print function of escpos-php, and finally the raw ESC/POS command, performs actual printing and page mode end.

    Related ESC/POS commands:

    ESC L Select Page mode
    ESC W Set print area in Page mode
    ESC T Select print direction in Page mode

    GS $ Set absolute vertical print position in Page mode
    ESC $ Set absolute print position
    GS \ Set relative vertical print position in Page mode
    ESC \ Set relative print position

    FF (in Page mode) Print and return to Standard mode (in Page mode)