RamyTalal / Label-Printer

Easily print labels with a Brother label printer.
MIT License
65 stars 22 forks source link

Special characters #32

Closed vaclavgreif closed 12 months ago

vaclavgreif commented 2 years ago

Is there any way to support special characters? I tried with template

$stream = stream_socket_client('tcp://10.0.0.16:9100', $errorNumber, $errorString);
$printer = new Printer(new Template(3, $stream));
$printer->addCommand(new Command\ObjectCommand('address', 'ěščřžýáíééĚŠČŘŽÝÁÍÍÉ'));
$printer->printLabel();    

The printed label is with wrong encoded characters.

vaclavgreif commented 1 year ago

@RamyTalal Any idea if this is somehow possible please?

RamyTalal commented 12 months ago

According to the Brother docs it should be possible, but I haven't implemented this yet.

See https://download.brother.com/welcome/docp000706/cv_ql720_eng_escp_100.pdf page 21.

vaclavgreif commented 12 months ago

Thanks. I actually got it working by setting the Character set to Windows-1250 using the Printer settings tool. After that the special characters are printed correctly. Encoding to Windows-1250 might be needed first before sending to printer:

$text = iconv("UTF-8//IGNORE", "WINDOWS-1250//IGNORE", $text)

Hope this helps someone.

Thanks for an awesome library! Hopefully you'll find some time to add the missing commands.. :)