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

very strange character replacements

Open welrachid opened this issue 4 years ago • 1 comments

Hi We are experiencing a very strange problem when doing a print on a epson tm-20iii (usb) printer.

Running on a raspberry pi 4 b, 4gb

We are running this file:

<?php
/**
 * This is a demo script for the functions of the PHP ESC/POS print driver,
 * Escpos.php.
 *
 * Most printers implement only a subset of the functionality of the driver, so
 * will not render this output correctly in all cases.
 *
 * @author Michael Billington <[email protected]>
 */
require __DIR__ . '/../vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
//use Mike42\Escpos\EscposImage;

$string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$length = strlen($string);
$string_reverse = '';
for ($i=($length-1) ; $i >= 0 ; $i--)
{
  $string_reverse .= $string[$i];
}

$connector = new FilePrintConnector("/dev/usb/lp0");
$printer = new Printer($connector);

/* Initialize */
$printer -> initialize();

/* Text */
$printer -> text("Hello world\n");
$printer -> feed(1);

$printer -> text($string."\n");
$printer -> feed(1);

$printer -> text(mb_strtolower($string."\n"));
$printer -> feed(1);

$printer -> text("1234567890\n");
$printer -> feed(1);

$printer -> text("Kolon :\n");
$printer -> feed(1);

$printer -> text("Comma ,\n");
$printer -> feed(1);

$printer -> text("Punktum .\n");
$printer -> feed(1);

$printer -> text("Bindestreg -\n");
$printer -> feed(1);

$printer -> text($string_reverse."\n");
$printer -> feed(1);

$printer -> text(mb_strtolower($string_reverse."\n"));
$printer -> feed(1);

$printer -> text("1234567890\n");
$printer -> feed(1);

$printer -> text("Kolon :\n");
$printer -> feed(1);

$printer -> text("Comma ,\n");
$printer -> feed(1);

$printer -> text("Punktum .\n");
$printer -> feed(1);

$printer -> text("Bindestreg -\n");
$printer -> feed();
$printer -> cut();
$printer->close();
die();

The result can be seen here. image

This is also something we experience on the examples in the project.

Do any of you have an idea what this might be caused by?

Thanks!

welrachid avatar Nov 11 '21 10:11 welrachid

A little update. We've tried to replace the SD-card with same result. We've put the SD-card into another raspberry pi 4 b, 4gb, which produced an other result. So this tells me that there is something wrong with the card itself. Is there any way for me using this software to "check" the bits of a simple usb stream operation?

Thanks.

welrachid avatar Nov 24 '21 03:11 welrachid